* limitations under the License.
*/
-// TODO: remove when added to public cordova repository -> begin
-var plugin_name = 'cordova-plugin-file.tizen.File';
-
-cordova.define(plugin_name, function(require, exports, module) {
-// TODO: remove -> end
-
-var pathsPrefix = {
- // TODO: add other directories
- // Read-only directory where the application is installed.
- applicationDirectory: 'wgt-package/'
-};
-
-exports.requestAllPaths = function(successCallback) {
- successCallback(pathsPrefix);
-};
-
-require("cordova/exec/proxy").add("File", exports);
-
-console.log('Loaded cordova.file API');
-
-// TODO: remove when added to public cordova repository -> begin
-});
-
-exports = function(require) {
- // this plugin is not loaded via cordova_plugins.js, we need to manually add
- // it to module mapper
- var mm = require('cordova/modulemapper');
- mm.runs(plugin_name);
-};
-//TODO: remove -> end
+//= require('DirectoryEntry.js');
+//= require('DirectoryReader.js');
+//= require('Entry.js');
+//= require('FileReader.js');
+//= require('fileSystemPaths.js');
+//= require('fileSystems-roots.js');
+//= require('FileWriter.js');
+//= require('requestFileSystem.js');
+//= require('resolveLocalFileSystemURI.js');
+
+//= require('File.js');
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// TODO: remove when added to public cordova repository -> begin
+cordova.define('cordova-plugin-file.tizen.DirectoryEntry', function(require, exports, module) {
+// TODO: remove -> end
+
+module.exports = {
+ getDirectory: function(successCallback, errorCallback, args) {},
+ removeRecursively: function(successCallback, errorCallback, args) {},
+ getFile: function(successCallback, errorCallback, args) {}
+};
+
+//TODO: remove when added to public cordova repository -> begin
+});
+//TODO: remove -> end
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// TODO: remove when added to public cordova repository -> begin
+cordova.define('cordova-plugin-file.tizen.DirectoryReader', function(require, exports, module) {
+// TODO: remove -> end
+
+module.exports = {
+ readEntries: function(successCallback, errorCallback, args) {}
+};
+
+//TODO: remove when added to public cordova repository -> begin
+});
+//TODO: remove -> end
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// TODO: remove when added to public cordova repository -> begin
+cordova.define('cordova-plugin-file.tizen.Entry', function(require, exports, module) {
+// TODO: remove -> end
+
+module.exports = {
+ getFileMetadata: function(successCallback, errorCallback, args) {},
+ setMetadata: function(successCallback, errorCallback, args) {},
+ moveTo: function(successCallback, errorCallback, args) {},
+ copyTo: function(successCallback, errorCallback, args) {},
+ remove: function(successCallback, errorCallback, args) {},
+ getParent: function(successCallback, errorCallback, args) {}
+};
+
+//TODO: remove when added to public cordova repository -> begin
+});
+//TODO: remove -> end
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// TODO: remove when added to public cordova repository -> begin
+var plugin_name = 'cordova-plugin-file.tizen.File';
+
+cordova.define(plugin_name, function(require, exports, module) {
+// TODO: remove -> end
+
+var modules = [
+ 'DirectoryEntry',
+ 'DirectoryReader',
+ 'Entry',
+ 'FileReader',
+ 'fileSystemPaths',
+ 'fileSystems-roots',
+ 'FileWriter',
+ 'requestFileSystem',
+ 'resolveLocalFileSystemURI'
+];
+
+// merge methods from submodules into this one
+for (var i = 0; i < modules.length; ++i) {
+ var m = require('cordova-plugin-file.tizen.' + modules[i]);
+ for (var prop in m) {
+ if (m.hasOwnProperty(prop)) {
+ exports[prop] = m[prop];
+ }
+ }
+}
+
+require("cordova/exec/proxy").add("File", exports);
+
+console.log('Loaded cordova.file API');
+
+//TODO: remove when added to public cordova repository -> begin
+});
+
+exports = function(require) {
+ // this plugin is not loaded via cordova_plugins.js, we need to manually add
+ // it to module mapper
+ var mm = require('cordova/modulemapper');
+ mm.runs(plugin_name);
+};
+//TODO: remove -> end
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// TODO: remove when added to public cordova repository -> begin
+cordova.define('cordova-plugin-file.tizen.FileReader', function(require, exports, module) {
+// TODO: remove -> end
+
+module.exports = {
+ readAsText: function(successCallback, errorCallback, args) {},
+ readAsDataURL: function(successCallback, errorCallback, args) {},
+ readAsBinaryString: function(successCallback, errorCallback, args) {},
+ readAsArrayBuffer: function(successCallback, errorCallback, args) {},
+};
+
+//TODO: remove when added to public cordova repository -> begin
+});
+//TODO: remove -> end
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// TODO: remove when added to public cordova repository -> begin
+cordova.define('cordova-plugin-file.tizen.FileWriter', function(require, exports, module) {
+// TODO: remove -> end
+
+module.exports = {
+ write: function(successCallback, errorCallback, args) {},
+ truncate: function(successCallback, errorCallback, args) {}
+};
+
+//TODO: remove when added to public cordova repository -> begin
+});
+//TODO: remove -> end
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// TODO: remove when added to public cordova repository -> begin
+cordova.define('cordova-plugin-file.tizen.fileSystemPaths', function(require, exports, module) {
+// TODO: remove -> end
+
+var pathsPrefix = {
+ // TODO: add other directories
+ // Read-only directory where the application is installed.
+ applicationDirectory: 'wgt-package/'
+};
+
+module.exports = {
+ requestAllPaths: function(successCallback, errorCallback, args) {
+ successCallback(pathsPrefix);
+ }
+};
+
+//TODO: remove when added to public cordova repository -> begin
+});
+//TODO: remove -> end
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// TODO: remove when added to public cordova repository -> begin
+cordova.define('cordova-plugin-file.tizen.fileSystems-roots', function(require, exports, module) {
+// TODO: remove -> end
+
+var info = (function() {
+ var roots_to_resolve = [
+ {
+ filesystemName: 'temporary',
+ name: '',
+ fullPath: '',
+ nativeURL: 'wgt-private-tmp'
+ },
+ {
+ filesystemName: 'persistent',
+ name: '',
+ fullPath: '',
+ nativeURL: 'wgt-private'
+ }
+ ];
+
+ var roots = [
+ {
+ filesystemName: 'root',
+ name: '',
+ fullPath: 'file:///',
+ nativeURL: '/'
+ }
+ ];
+
+ function getRoots(successCallback) {
+ if (roots_to_resolve.length > 0) {
+ tizen.filesystem.resolve(roots_to_resolve[0].nativeURL, function(dir) {
+ roots_to_resolve[0].fullPath = dir.toURI();
+ roots_to_resolve[0].name = roots_to_resolve[0].fullPath.replace(/^.*(\\|\/|\:)/, ''); // extract name of the directory
+ roots.push(roots_to_resolve[0]);
+ roots_to_resolve.splice(0, 1); // remove first item
+
+ // we've resolved one root, check if there are any other
+ getRoots(successCallback);
+ }, function(e) {
+ console.error(e);
+ // in case of an error, return the roots we have so far
+ successCallback(roots);
+ });
+ } else {
+ successCallback(roots.slice());
+ }
+ }
+
+ return {
+ getRoots: getRoots
+ };
+})();
+
+module.exports = {
+ requestAllFileSystems: function(successCallback, errorCallback, args) {
+ info.getRoots(successCallback);
+ }
+};
+
+//TODO: remove when added to public cordova repository -> begin
+});
+//TODO: remove -> end
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// TODO: remove when added to public cordova repository -> begin
+cordova.define('cordova-plugin-file.tizen.requestFileSystem', function(require, exports, module) {
+// TODO: remove -> end
+
+module.exports = {
+ requestFileSystem: function(successCallback, errorCallback, args) {}
+};
+
+//TODO: remove when added to public cordova repository -> begin
+});
+//TODO: remove -> end
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// TODO: remove when added to public cordova repository -> begin
+cordova.define('cordova-plugin-file.tizen.resolveLocalFileSystemURI', function(require, exports, module) {
+// TODO: remove -> end
+
+module.exports = {
+ resolveLocalFileSystemURI: function(successCallback, errorCallback, args) {}
+};
+
+//TODO: remove when added to public cordova repository -> begin
+});
+//TODO: remove -> end