You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2014/04/25 20:13:48 UTC
[2/8] CB-6521: Remove development branch
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/FileError.js
----------------------------------------------------------------------
diff --git a/www/FileError.js b/www/FileError.js
deleted file mode 100644
index 6507921..0000000
--- a/www/FileError.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-/**
- * FileError
- */
-function FileError(error) {
- this.code = error || null;
-}
-
-// File error codes
-// Found in DOMException
-FileError.NOT_FOUND_ERR = 1;
-FileError.SECURITY_ERR = 2;
-FileError.ABORT_ERR = 3;
-
-// Added by File API specification
-FileError.NOT_READABLE_ERR = 4;
-FileError.ENCODING_ERR = 5;
-FileError.NO_MODIFICATION_ALLOWED_ERR = 6;
-FileError.INVALID_STATE_ERR = 7;
-FileError.SYNTAX_ERR = 8;
-FileError.INVALID_MODIFICATION_ERR = 9;
-FileError.QUOTA_EXCEEDED_ERR = 10;
-FileError.TYPE_MISMATCH_ERR = 11;
-FileError.PATH_EXISTS_ERR = 12;
-
-module.exports = FileError;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/FileReader.js
----------------------------------------------------------------------
diff --git a/www/FileReader.js b/www/FileReader.js
deleted file mode 100644
index c0d5849..0000000
--- a/www/FileReader.js
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var exec = require('cordova/exec'),
- modulemapper = require('cordova/modulemapper'),
- utils = require('cordova/utils'),
- File = require('./File'),
- FileError = require('./FileError'),
- ProgressEvent = require('./ProgressEvent'),
- origFileReader = modulemapper.getOriginalSymbol(this, 'FileReader');
-
-/**
- * This class reads the mobile device file system.
- *
- * For Android:
- * The root directory is the root of the file system.
- * To read from the SD card, the file name is "sdcard/my_file.txt"
- * @constructor
- */
-var FileReader = function() {
- this._readyState = 0;
- this._error = null;
- this._result = null;
- this._localURL = '';
- this._realReader = origFileReader ? new origFileReader() : {};
-};
-
-// States
-FileReader.EMPTY = 0;
-FileReader.LOADING = 1;
-FileReader.DONE = 2;
-
-utils.defineGetter(FileReader.prototype, 'readyState', function() {
- return this._localURL ? this._readyState : this._realReader.readyState;
-});
-
-utils.defineGetter(FileReader.prototype, 'error', function() {
- return this._localURL ? this._error: this._realReader.error;
-});
-
-utils.defineGetter(FileReader.prototype, 'result', function() {
- return this._localURL ? this._result: this._realReader.result;
-});
-
-function defineEvent(eventName) {
- utils.defineGetterSetter(FileReader.prototype, eventName, function() {
- return this._realReader[eventName] || null;
- }, function(value) {
- this._realReader[eventName] = value;
- });
-}
-defineEvent('onloadstart'); // When the read starts.
-defineEvent('onprogress'); // While reading (and decoding) file or fileBlob data, and reporting partial file data (progress.loaded/progress.total)
-defineEvent('onload'); // When the read has successfully completed.
-defineEvent('onerror'); // When the read has failed (see errors).
-defineEvent('onloadend'); // When the request has completed (either in success or failure).
-defineEvent('onabort'); // When the read has been aborted. For instance, by invoking the abort() method.
-
-function initRead(reader, file) {
- // Already loading something
- if (reader.readyState == FileReader.LOADING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- reader._result = null;
- reader._error = null;
- reader._readyState = FileReader.LOADING;
-
- if (typeof file.localURL == 'string') {
- reader._localURL = file.localURL;
- } else {
- reader._localURL = '';
- return true;
- }
-
- reader.onloadstart && reader.onloadstart(new ProgressEvent("loadstart", {target:reader}));
-}
-
-/**
- * Abort reading file.
- */
-FileReader.prototype.abort = function() {
- if (origFileReader && !this._localURL) {
- return this._realReader.abort();
- }
- this._result = null;
-
- if (this._readyState == FileReader.DONE || this._readyState == FileReader.EMPTY) {
- return;
- }
-
- this._readyState = FileReader.DONE;
-
- // If abort callback
- if (typeof this.onabort === 'function') {
- this.onabort(new ProgressEvent('abort', {target:this}));
- }
- // If load end callback
- if (typeof this.onloadend === 'function') {
- this.onloadend(new ProgressEvent('loadend', {target:this}));
- }
-};
-
-/**
- * Read text file.
- *
- * @param file {File} File object containing file properties
- * @param encoding [Optional] (see http://www.iana.org/assignments/character-sets)
- */
-FileReader.prototype.readAsText = function(file, encoding) {
- if (initRead(this, file)) {
- return this._realReader.readAsText(file, encoding);
- }
-
- // Default encoding is UTF-8
- var enc = encoding ? encoding : "UTF-8";
- var me = this;
- var execArgs = [this._localURL, enc, file.start, file.end];
-
- // Read file
- exec(
- // Success callback
- function(r) {
- // If DONE (cancelled), then don't do anything
- if (me._readyState === FileReader.DONE) {
- return;
- }
-
- // Save result
- me._result = r;
-
- // If onload callback
- if (typeof me.onload === "function") {
- me.onload(new ProgressEvent("load", {target:me}));
- }
-
- // DONE state
- me._readyState = FileReader.DONE;
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- },
- // Error callback
- function(e) {
- // If DONE (cancelled), then don't do anything
- if (me._readyState === FileReader.DONE) {
- return;
- }
-
- // DONE state
- me._readyState = FileReader.DONE;
-
- // null result
- me._result = null;
-
- // Save error
- me._error = new FileError(e);
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror(new ProgressEvent("error", {target:me}));
- }
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- }, "File", "readAsText", execArgs);
-};
-
-
-/**
- * Read file and return data as a base64 encoded data url.
- * A data url is of the form:
- * data:[<mediatype>][;base64],<data>
- *
- * @param file {File} File object containing file properties
- */
-FileReader.prototype.readAsDataURL = function(file) {
- if (initRead(this, file)) {
- return this._realReader.readAsDataURL(file);
- }
-
- var me = this;
- var execArgs = [this._localURL, file.start, file.end];
-
- // Read file
- exec(
- // Success callback
- function(r) {
- // If DONE (cancelled), then don't do anything
- if (me._readyState === FileReader.DONE) {
- return;
- }
-
- // DONE state
- me._readyState = FileReader.DONE;
-
- // Save result
- me._result = r;
-
- // If onload callback
- if (typeof me.onload === "function") {
- me.onload(new ProgressEvent("load", {target:me}));
- }
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- },
- // Error callback
- function(e) {
- // If DONE (cancelled), then don't do anything
- if (me._readyState === FileReader.DONE) {
- return;
- }
-
- // DONE state
- me._readyState = FileReader.DONE;
-
- me._result = null;
-
- // Save error
- me._error = new FileError(e);
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror(new ProgressEvent("error", {target:me}));
- }
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- }, "File", "readAsDataURL", execArgs);
-};
-
-/**
- * Read file and return data as a binary data.
- *
- * @param file {File} File object containing file properties
- */
-FileReader.prototype.readAsBinaryString = function(file) {
- if (initRead(this, file)) {
- return this._realReader.readAsBinaryString(file);
- }
-
- var me = this;
- var execArgs = [this._localURL, file.start, file.end];
-
- // Read file
- exec(
- // Success callback
- function(r) {
- // If DONE (cancelled), then don't do anything
- if (me._readyState === FileReader.DONE) {
- return;
- }
-
- // DONE state
- me._readyState = FileReader.DONE;
-
- me._result = r;
-
- // If onload callback
- if (typeof me.onload === "function") {
- me.onload(new ProgressEvent("load", {target:me}));
- }
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- },
- // Error callback
- function(e) {
- // If DONE (cancelled), then don't do anything
- if (me._readyState === FileReader.DONE) {
- return;
- }
-
- // DONE state
- me._readyState = FileReader.DONE;
-
- me._result = null;
-
- // Save error
- me._error = new FileError(e);
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror(new ProgressEvent("error", {target:me}));
- }
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- }, "File", "readAsBinaryString", execArgs);
-};
-
-/**
- * Read file and return data as a binary data.
- *
- * @param file {File} File object containing file properties
- */
-FileReader.prototype.readAsArrayBuffer = function(file) {
- if (initRead(this, file)) {
- return this._realReader.readAsArrayBuffer(file);
- }
-
- var me = this;
- var execArgs = [this._localURL, file.start, file.end];
-
- // Read file
- exec(
- // Success callback
- function(r) {
- // If DONE (cancelled), then don't do anything
- if (me._readyState === FileReader.DONE) {
- return;
- }
-
- // DONE state
- me._readyState = FileReader.DONE;
-
- me._result = r;
-
- // If onload callback
- if (typeof me.onload === "function") {
- me.onload(new ProgressEvent("load", {target:me}));
- }
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- },
- // Error callback
- function(e) {
- // If DONE (cancelled), then don't do anything
- if (me._readyState === FileReader.DONE) {
- return;
- }
-
- // DONE state
- me._readyState = FileReader.DONE;
-
- me._result = null;
-
- // Save error
- me._error = new FileError(e);
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror(new ProgressEvent("error", {target:me}));
- }
-
- // If onloadend callback
- if (typeof me.onloadend === "function") {
- me.onloadend(new ProgressEvent("loadend", {target:me}));
- }
- }, "File", "readAsArrayBuffer", execArgs);
-};
-
-module.exports = FileReader;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/FileSystem.js
----------------------------------------------------------------------
diff --git a/www/FileSystem.js b/www/FileSystem.js
deleted file mode 100644
index 7ac4671..0000000
--- a/www/FileSystem.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var DirectoryEntry = require('./DirectoryEntry');
-
-/**
- * An interface representing a file system
- *
- * @constructor
- * {DOMString} name the unique name of the file system (readonly)
- * {DirectoryEntry} root directory of the file system (readonly)
- */
-var FileSystem = function(name, root) {
- this.name = name || null;
- if (root) {
- this.root = new DirectoryEntry(root.name, root.fullPath, this);
- } else {
- this.root = new DirectoryEntry(this.name, '/', this);
- }
-};
-
-FileSystem.prototype.__format__ = function(fullPath) {
- return fullPath;
-};
-
-FileSystem.prototype.toJSON = function() {
- return "<FileSystem: " + this.name + ">";
-};
-
-module.exports = FileSystem;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/FileUploadOptions.js
----------------------------------------------------------------------
diff --git a/www/FileUploadOptions.js b/www/FileUploadOptions.js
deleted file mode 100644
index b2977de..0000000
--- a/www/FileUploadOptions.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-/**
- * Options to customize the HTTP request used to upload files.
- * @constructor
- * @param fileKey {String} Name of file request parameter.
- * @param fileName {String} Filename to be used by the server. Defaults to image.jpg.
- * @param mimeType {String} Mimetype of the uploaded file. Defaults to image/jpeg.
- * @param params {Object} Object with key: value params to send to the server.
- * @param headers {Object} Keys are header names, values are header values. Multiple
- * headers of the same name are not supported.
- */
-var FileUploadOptions = function(fileKey, fileName, mimeType, params, headers, httpMethod) {
- this.fileKey = fileKey || null;
- this.fileName = fileName || null;
- this.mimeType = mimeType || null;
- this.params = params || null;
- this.headers = headers || null;
- this.httpMethod = httpMethod || null;
-};
-
-module.exports = FileUploadOptions;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/FileUploadResult.js
----------------------------------------------------------------------
diff --git a/www/FileUploadResult.js b/www/FileUploadResult.js
deleted file mode 100644
index 4f2e33e..0000000
--- a/www/FileUploadResult.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-/**
- * FileUploadResult
- * @constructor
- */
-module.exports = function FileUploadResult(size, code, content) {
- this.bytesSent = size;
- this.responseCode = code;
- this.response = content;
- };
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/FileWriter.js
----------------------------------------------------------------------
diff --git a/www/FileWriter.js b/www/FileWriter.js
deleted file mode 100644
index 786e994..0000000
--- a/www/FileWriter.js
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var exec = require('cordova/exec'),
- FileError = require('./FileError'),
- ProgressEvent = require('./ProgressEvent');
-
-/**
- * This class writes to the mobile device file system.
- *
- * For Android:
- * The root directory is the root of the file system.
- * To write to the SD card, the file name is "sdcard/my_file.txt"
- *
- * @constructor
- * @param file {File} File object containing file properties
- * @param append if true write to the end of the file, otherwise overwrite the file
- */
-var FileWriter = function(file) {
- this.fileName = "";
- this.length = 0;
- if (file) {
- this.localURL = file.localURL || file;
- this.length = file.size || 0;
- }
- // default is to write at the beginning of the file
- this.position = 0;
-
- this.readyState = 0; // EMPTY
-
- this.result = null;
-
- // Error
- this.error = null;
-
- // Event handlers
- this.onwritestart = null; // When writing starts
- this.onprogress = null; // While writing the file, and reporting partial file data
- this.onwrite = null; // When the write has successfully completed.
- this.onwriteend = null; // When the request has completed (either in success or failure).
- this.onabort = null; // When the write has been aborted. For instance, by invoking the abort() method.
- this.onerror = null; // When the write has failed (see errors).
-};
-
-// States
-FileWriter.INIT = 0;
-FileWriter.WRITING = 1;
-FileWriter.DONE = 2;
-
-/**
- * Abort writing file.
- */
-FileWriter.prototype.abort = function() {
- // check for invalid state
- if (this.readyState === FileWriter.DONE || this.readyState === FileWriter.INIT) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- // set error
- this.error = new FileError(FileError.ABORT_ERR);
-
- this.readyState = FileWriter.DONE;
-
- // If abort callback
- if (typeof this.onabort === "function") {
- this.onabort(new ProgressEvent("abort", {"target":this}));
- }
-
- // If write end callback
- if (typeof this.onwriteend === "function") {
- this.onwriteend(new ProgressEvent("writeend", {"target":this}));
- }
-};
-
-/**
- * Writes data to the file
- *
- * @param data text or blob to be written
- */
-FileWriter.prototype.write = function(data) {
-
- var that=this;
- var supportsBinary = (typeof window.Blob !== 'undefined' && typeof window.ArrayBuffer !== 'undefined');
- var isBinary;
-
- // Check to see if the incoming data is a blob
- if (data instanceof File || (supportsBinary && data instanceof Blob)) {
- var fileReader = new FileReader();
- fileReader.onload = function() {
- // Call this method again, with the arraybuffer as argument
- FileWriter.prototype.write.call(that, this.result);
- };
- if (supportsBinary) {
- fileReader.readAsArrayBuffer(data);
- } else {
- fileReader.readAsText(data);
- }
- return;
- }
-
- // Mark data type for safer transport over the binary bridge
- isBinary = supportsBinary && (data instanceof ArrayBuffer);
- if (isBinary && ['windowsphone', 'windows8'].indexOf(cordova.platformId) >= 0) {
- // create a plain array, using the keys from the Uint8Array view so that we can serialize it
- data = Array.apply(null, new Uint8Array(data));
- }
-
- // Throw an exception if we are already writing a file
- if (this.readyState === FileWriter.WRITING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- // WRITING state
- this.readyState = FileWriter.WRITING;
-
- var me = this;
-
- // If onwritestart callback
- if (typeof me.onwritestart === "function") {
- me.onwritestart(new ProgressEvent("writestart", {"target":me}));
- }
-
- // Write file
- exec(
- // Success callback
- function(r) {
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileWriter.DONE) {
- return;
- }
-
- // position always increases by bytes written because file would be extended
- me.position += r;
- // The length of the file is now where we are done writing.
-
- me.length = me.position;
-
- // DONE state
- me.readyState = FileWriter.DONE;
-
- // If onwrite callback
- if (typeof me.onwrite === "function") {
- me.onwrite(new ProgressEvent("write", {"target":me}));
- }
-
- // If onwriteend callback
- if (typeof me.onwriteend === "function") {
- me.onwriteend(new ProgressEvent("writeend", {"target":me}));
- }
- },
- // Error callback
- function(e) {
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileWriter.DONE) {
- return;
- }
-
- // DONE state
- me.readyState = FileWriter.DONE;
-
- // Save error
- me.error = new FileError(e);
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror(new ProgressEvent("error", {"target":me}));
- }
-
- // If onwriteend callback
- if (typeof me.onwriteend === "function") {
- me.onwriteend(new ProgressEvent("writeend", {"target":me}));
- }
- }, "File", "write", [this.localURL, data, this.position, isBinary]);
-};
-
-/**
- * Moves the file pointer to the location specified.
- *
- * If the offset is a negative number the position of the file
- * pointer is rewound. If the offset is greater than the file
- * size the position is set to the end of the file.
- *
- * @param offset is the location to move the file pointer to.
- */
-FileWriter.prototype.seek = function(offset) {
- // Throw an exception if we are already writing a file
- if (this.readyState === FileWriter.WRITING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- if (!offset && offset !== 0) {
- return;
- }
-
- // See back from end of file.
- if (offset < 0) {
- this.position = Math.max(offset + this.length, 0);
- }
- // Offset is bigger than file size so set position
- // to the end of the file.
- else if (offset > this.length) {
- this.position = this.length;
- }
- // Offset is between 0 and file size so set the position
- // to start writing.
- else {
- this.position = offset;
- }
-};
-
-/**
- * Truncates the file to the size specified.
- *
- * @param size to chop the file at.
- */
-FileWriter.prototype.truncate = function(size) {
- // Throw an exception if we are already writing a file
- if (this.readyState === FileWriter.WRITING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- // WRITING state
- this.readyState = FileWriter.WRITING;
-
- var me = this;
-
- // If onwritestart callback
- if (typeof me.onwritestart === "function") {
- me.onwritestart(new ProgressEvent("writestart", {"target":this}));
- }
-
- // Write file
- exec(
- // Success callback
- function(r) {
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileWriter.DONE) {
- return;
- }
-
- // DONE state
- me.readyState = FileWriter.DONE;
-
- // Update the length of the file
- me.length = r;
- me.position = Math.min(me.position, r);
-
- // If onwrite callback
- if (typeof me.onwrite === "function") {
- me.onwrite(new ProgressEvent("write", {"target":me}));
- }
-
- // If onwriteend callback
- if (typeof me.onwriteend === "function") {
- me.onwriteend(new ProgressEvent("writeend", {"target":me}));
- }
- },
- // Error callback
- function(e) {
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileWriter.DONE) {
- return;
- }
-
- // DONE state
- me.readyState = FileWriter.DONE;
-
- // Save error
- me.error = new FileError(e);
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror(new ProgressEvent("error", {"target":me}));
- }
-
- // If onwriteend callback
- if (typeof me.onwriteend === "function") {
- me.onwriteend(new ProgressEvent("writeend", {"target":me}));
- }
- }, "File", "truncate", [this.localURL, size]);
-};
-
-module.exports = FileWriter;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/Flags.js
----------------------------------------------------------------------
diff --git a/www/Flags.js b/www/Flags.js
deleted file mode 100644
index a9ae6da..0000000
--- a/www/Flags.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-/**
- * Supplies arguments to methods that lookup or create files and directories.
- *
- * @param create
- * {boolean} file or directory if it doesn't exist
- * @param exclusive
- * {boolean} used with create; if true the command will fail if
- * target path exists
- */
-function Flags(create, exclusive) {
- this.create = create || false;
- this.exclusive = exclusive || false;
-}
-
-module.exports = Flags;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/LocalFileSystem.js
----------------------------------------------------------------------
diff --git a/www/LocalFileSystem.js b/www/LocalFileSystem.js
deleted file mode 100644
index 1e8f2ee..0000000
--- a/www/LocalFileSystem.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-exports.TEMPORARY = 0;
-exports.PERSISTENT = 1;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/Metadata.js
----------------------------------------------------------------------
diff --git a/www/Metadata.js b/www/Metadata.js
deleted file mode 100644
index f95c44c..0000000
--- a/www/Metadata.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-/**
- * Information about the state of the file or directory
- *
- * {Date} modificationTime (readonly)
- */
-var Metadata = function(metadata) {
- if (typeof metadata == "object") {
- this.modificationTime = new Date(metadata.modificationTime);
- this.size = metadata.size || 0;
- } else if (typeof metadata == "undefined") {
- this.modificationTime = null;
- this.size = 0;
- } else {
- /* Backwards compatiblity with platforms that only return a timestamp */
- this.modificationTime = new Date(metadata);
- }
-};
-
-module.exports = Metadata;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/ProgressEvent.js
----------------------------------------------------------------------
diff --git a/www/ProgressEvent.js b/www/ProgressEvent.js
deleted file mode 100644
index f176f80..0000000
--- a/www/ProgressEvent.js
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-// If ProgressEvent exists in global context, use it already, otherwise use our own polyfill
-// Feature test: See if we can instantiate a native ProgressEvent;
-// if so, use that approach,
-// otherwise fill-in with our own implementation.
-//
-// NOTE: right now we always fill in with our own. Down the road would be nice if we can use whatever is native in the webview.
-var ProgressEvent = (function() {
- /*
- var createEvent = function(data) {
- var event = document.createEvent('Events');
- event.initEvent('ProgressEvent', false, false);
- if (data) {
- for (var i in data) {
- if (data.hasOwnProperty(i)) {
- event[i] = data[i];
- }
- }
- if (data.target) {
- // TODO: cannot call <some_custom_object>.dispatchEvent
- // need to first figure out how to implement EventTarget
- }
- }
- return event;
- };
- try {
- var ev = createEvent({type:"abort",target:document});
- return function ProgressEvent(type, data) {
- data.type = type;
- return createEvent(data);
- };
- } catch(e){
- */
- return function ProgressEvent(type, dict) {
- this.type = type;
- this.bubbles = false;
- this.cancelBubble = false;
- this.cancelable = false;
- this.lengthComputable = false;
- this.loaded = dict && dict.loaded ? dict.loaded : 0;
- this.total = dict && dict.total ? dict.total : 0;
- this.target = dict && dict.target ? dict.target : null;
- };
- //}
-})();
-
-module.exports = ProgressEvent;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/android/FileSystem.js
----------------------------------------------------------------------
diff --git a/www/android/FileSystem.js b/www/android/FileSystem.js
deleted file mode 100644
index fde9c7a..0000000
--- a/www/android/FileSystem.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-FILESYSTEM_PROTOCOL = "cdvfile";
-
-module.exports = {
- __format__: function(fullPath) {
- if (this.name === 'content') {
- return 'content:/' + fullPath;
- }
- var path = ('/'+this.name+(fullPath[0]==='/'?'':'/')+encodeURI(fullPath)).replace('//','/');
- return FILESYSTEM_PROTOCOL + '://localhost' + path;
- }
-};
-
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/blackberry10/DirectoryEntry.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/DirectoryEntry.js b/www/blackberry10/DirectoryEntry.js
deleted file mode 100644
index 64ded02..0000000
--- a/www/blackberry10/DirectoryEntry.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var argscheck = require('cordova/argscheck'),
- utils = require('cordova/utils'),
- Entry = require('./BB10Entry'),
- FileError = require('./FileError'),
- DirectoryReader = require('./BB10DirectoryReader'),
- fileUtils = require('./BB10Utils'),
- DirectoryEntry = function (name, fullPath, fileSystem) {
- DirectoryEntry.__super__.constructor.call(this, false, true, name, fullPath, fileSystem);
- };
-
-if (!window.requestAnimationFrame) {
- window.requestAnimationFrame = function (callback) { callback(); };
-}
-
-utils.extend(DirectoryEntry, Entry);
-
-DirectoryEntry.prototype.createReader = function () {
- return new DirectoryReader(this.fullPath);
-};
-
-DirectoryEntry.prototype.getDirectory = function (path, options, successCallback, errorCallback) {
- var currentPath = this.nativeEntry.fullPath,
- that = this,
- fullPath;
-
- if (path.indexOf("/") === 0) {
- fullPath = path;
- } else {
- fullPath = currentPath + "/" + path;
- }
-
- argscheck.checkArgs('sOFF', 'DirectoryEntry.getDirectory', arguments);
-
- if (fileUtils.isOutsideSandbox(fullPath)) {
- cordova.exec(function () {
- window.requestAnimationFrame(function () {
- window.webkitRequestFileSystem(window.PERSISTENT, that.filesystem._size, function (fs) {
- fs.root.getDirectory(fullPath, options, function (entry) {
- successCallback(fileUtils.createEntry(entry));
- }, errorCallback);
- }, errorCallback);
- });
- }, errorCallback, "org.apache.cordova.file", "setSandbox", [false]);
- } else {
- cordova.exec(function () {
- window.requestAnimationFrame(function () {
- window.webkitRequestFileSystem(fileUtils.getFileSystemName(that.filesystem) === "persistent" ? window.PERSISTENT : window.TEMPORARY, that.filesystem._size, function (fs) {
- fs.root.getDirectory(fullPath, options, function (entry) {
- successCallback(fileUtils.createEntry(entry));
- }, errorCallback);
- }, errorCallback);
- });
- }, errorCallback, "org.apache.cordova.file", "setSandbox", [true]);
- }
-};
-
-DirectoryEntry.prototype.removeRecursively = function (successCallback, errorCallback) {
- argscheck.checkArgs('FF', 'DirectoryEntry.removeRecursively', arguments);
- this.nativeEntry.removeRecursively(successCallback, errorCallback);
-};
-
-DirectoryEntry.prototype.getFile = function (path, options, successCallback, errorCallback) {
- var currentPath = this.nativeEntry.fullPath,
- that = this,
- fullPath;
-
- if (path.indexOf("/") === 0) {
- fullPath = path;
- } else {
- fullPath = currentPath + "/" + path;
- }
-
- argscheck.checkArgs('sOFF', 'DirectoryEntry.getFile', arguments);
-
- if (fileUtils.isOutsideSandbox(fullPath)) {
- cordova.exec(function () {
- window.requestAnimationFrame(function () {
- window.webkitRequestFileSystem(window.PERSISTENT, that.filesystem._size, function (fs) {
- fs.root.getFile(fullPath, options, function (entry) {
- successCallback(fileUtils.createEntry(entry));
- }, errorCallback);
- }, errorCallback);
- });
- }, errorCallback, "org.apache.cordova.file", "setSandbox", [false]);
- } else {
- cordova.exec(function () {
- window.requestAnimationFrame(function () {
- window.webkitRequestFileSystem(fileUtils.getFileSystemName(that.filesystem) === "persistent" ? window.PERSISTENT: window.TEMPORARY, that.filesystem._size, function (fs) {
- fs.root.getFile(fullPath, options, function (entry) {
- successCallback(fileUtils.createEntry(entry));
- }, errorCallback);
- }, errorCallback);
- });
- }, errorCallback, "org.apache.cordova.file", "setSandbox", [true]);
- }
-};
-
-module.exports = DirectoryEntry;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/blackberry10/DirectoryReader.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/DirectoryReader.js b/www/blackberry10/DirectoryReader.js
deleted file mode 100644
index 6aa3d73..0000000
--- a/www/blackberry10/DirectoryReader.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var FileError = require('./FileError'),
- fileUtils = require('./BB10Utils');
-
-function DirectoryReader(path) {
- this.path = path;
- this.nativeReader = null;
-}
-
-DirectoryReader.prototype.readEntries = function(successCallback, errorCallback) {
- var self = this,
- win = typeof successCallback !== 'function' ? null : function(result) {
- var retVal = [];
- for (var i=0; i<result.length; i++) {
- retVal.push(fileUtils.createEntry(result[i]));
- }
- successCallback(retVal);
- },
- fail = typeof errorCallback !== 'function' ? null : function(code) {
- errorCallback(new FileError(code));
- };
- if (this.nativeReader) {
- this.nativeReader.readEntries(win, fail);
- } else {
- resolveLocalFileSystemURI("filesystem:local:///persistent/" + this.path, function (entry) {
- self.nativeReader = entry.nativeEntry.createReader()
- self.nativeReader.readEntries(win, fail);
- }, function () {
- fail(FileError.NOT_FOUND_ERR);
- });
- }
-};
-
-module.exports = DirectoryReader;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/blackberry10/Entry.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/Entry.js b/www/blackberry10/Entry.js
deleted file mode 100644
index 7554e06..0000000
--- a/www/blackberry10/Entry.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var argscheck = require('cordova/argscheck'),
- FileError = require('./FileError'),
- Metadata = require('./Metadata'),
- fileUtils = require('./BB10Utils');
-
-function Entry(isFile, isDirectory, name, fullPath, fileSystem) {
- var strippedPath;
- if (fullPath && fullPath.charAt(fullPath.length - 1) === '/') {
- strippedPath = fullPath.slice(0, -1);
- }
- this.isFile = !!isFile;
- this.isDirectory = !!isDirectory;
- this.name = name || '';
- this.fullPath = typeof strippedPath !== "undefined" ? strippedPath : (fullPath || '');
- this.filesystem = fileSystem || null;
-}
-
-Entry.prototype.getMetadata = function(successCallback, errorCallback) {
- argscheck.checkArgs('FF', 'Entry.getMetadata', arguments);
- var success = function(lastModified) {
- var metadata = new Metadata(lastModified);
- if (typeof successCallback === 'function') {
- successCallback(metadata);
- }
- };
- this.nativeEntry.getMetadata(success, errorCallback);
-};
-
-Entry.prototype.setMetadata = function(successCallback, errorCallback, metadataObject) {
- argscheck.checkArgs('FFO', 'Entry.setMetadata', arguments);
- errorCallback("Not supported by platform");
-};
-
-Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallback) {
- argscheck.checkArgs('oSFF', 'Entry.moveTo', arguments);
- var srcPath = this.fullPath,
- name = newName || this.name,
- success = function(entry) {
- if (entry) {
- if (typeof successCallback === 'function') {
- successCallback(fileUtils.createEntry(entry));
- }
- }
- else {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(FileError.NOT_FOUND_ERR));
- }
- }
- };
- this.nativeEntry.moveTo(parent.nativeEntry, newName, success, errorCallback);
-};
-
-
-Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallback) {
- argscheck.checkArgs('oSFF', 'Entry.copyTo', arguments);
- var srcPath = this.fullPath,
- name = newName || this.name,
- success = function(entry) {
- if (entry) {
- if (typeof successCallback === 'function') {
- successCallback(fileUtils.createEntry(entry));
- }
- }
- else {
- if (typeof errorCallback === 'function') {
- errorCallback(new FileError(FileError.NOT_FOUND_ERR));
- }
- }
- };
- this.nativeEntry.copyTo(parent.nativeEntry, newName, success, errorCallback);
-};
-
-Entry.prototype.toURL = function() {
- return "file://" + this.nativeEntry.fullPath;
-};
-
-Entry.prototype.toURI = function(mimeType) {
- console.log("DEPRECATED: Update your code to use 'toURL'");
- return this.toURL();
-};
-
-Entry.prototype.remove = function(successCallback, errorCallback) {
- argscheck.checkArgs('FF', 'Entry.remove', arguments);
- this.nativeEntry.remove(successCallback, errorCallback);
-};
-
-Entry.prototype.getParent = function(successCallback, errorCallback) {
- argscheck.checkArgs('FF', 'Entry.getParent', arguments);
- var win = successCallback && function(result) {
- successCallback(fileUtils.createEntry(result));
- };
- this.nativeEntry.getParent(win, errorCallback);
-};
-
-module.exports = Entry;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/blackberry10/File.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/File.js b/www/blackberry10/File.js
deleted file mode 100644
index 7ba9734..0000000
--- a/www/blackberry10/File.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var fileUtils = require('./BB10Utils');
-
-/**
- * Constructor.
- * name {DOMString} name of the file, without path information
- * fullPath {DOMString} the full path of the file, including the name
- * type {DOMString} mime type
- * lastModifiedDate {Date} last modified date
- * size {Number} size of the file in bytes
- */
-
-var File = function(name, fullPath, type, lastModifiedDate, size){
- this.name = name || '';
- this.fullPath = fullPath || null;
- this.type = type || null;
- this.lastModifiedDate = lastModifiedDate || null;
- this.size = size || 0;
-
- // These store the absolute start and end for slicing the file.
- this.start = 0;
- this.end = this.size;
-};
-
-/**
- * Returns a "slice" of the file.
- * Slices of slices are supported.
- * start {Number} The index at which to start the slice (inclusive).
- * end {Number} The index at which to end the slice (exclusive).
- */
-File.prototype.slice = function(start, end) {
- return fileUtils.createFile(this.nativeFile.slice(start, end));
-};
-
-
-module.exports = File;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/blackberry10/FileEntry.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileEntry.js b/www/blackberry10/FileEntry.js
deleted file mode 100644
index b358d71..0000000
--- a/www/blackberry10/FileEntry.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var utils = require('cordova/utils'),
- Entry = require('./BB10Entry'),
- FileWriter = require('./BB10FileWriter'),
- File = require('./BB10File'),
- fileUtils = require('./BB10Utils'),
- FileError = require('./FileError'),
- FileEntry = function (name, fullPath, fileSystem) {
- FileEntry.__super__.constructor.apply(this, [true, false, name, fullPath, fileSystem]);
- };
-
-utils.extend(FileEntry, Entry);
-
-FileEntry.prototype.createWriter = function(successCallback, errorCallback) {
- this.file(function (file) {
- successCallback(new FileWriter(file));
- }, errorCallback);
-};
-
-FileEntry.prototype.file = function(successCallback, errorCallback) {
- var fullPath = this.fullPath,
- success = function (file) {
- file.fullPath = fullPath;
- successCallback(fileUtils.createFile(file));
- };
- this.nativeEntry.file(success, errorCallback);
-};
-
-module.exports = FileEntry;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/blackberry10/FileReader.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileReader.js b/www/blackberry10/FileReader.js
deleted file mode 100644
index a3943ba..0000000
--- a/www/blackberry10/FileReader.js
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var origFileReader = window.FileReader,
- fileUtils = require('./BB10Utils'),
- utils = require('cordova/utils');
-
-var FileReader = function() {
- this.nativeReader = new origFileReader();
-};
-
-utils.defineGetter(FileReader.prototype, 'readyState', function() {
- return this.nativeReader.readyState;
-});
-
-utils.defineGetter(FileReader.prototype, 'error', function() {
- return this.nativeReader.error;
-});
-
-utils.defineGetter(FileReader.prototype, 'result', function() {
- return this.nativeReader.result;
-});
-
-function defineEvent(eventName) {
- utils.defineGetterSetter(FileReader.prototype, eventName, function() {
- return this.nativeReader[eventName] || null;
- }, function(value) {
- this.nativeReader[eventName] = value;
- });
-}
-
-defineEvent('onabort');
-defineEvent('onerror');
-defineEvent('onload');
-defineEvent('onloadend');
-defineEvent('onloadstart');
-defineEvent('onprogress');
-
-FileReader.prototype.abort = function() {
- return this.nativeReader.abort();
-};
-
-function read(method, context, file, encoding) {
- if (file.fullPath) {
- resolveLocalFileSystemURI(file.fullPath, function (entry) {
- entry.nativeEntry.file(function (nativeFile) {
- context.nativeReader[method].call(context.nativeReader, nativeFile, encoding);
- }, context.onerror);
- }, context.onerror);
- } else {
- context.nativeReader[method](file, encoding);
- }
-}
-
-FileReader.prototype.readAsText = function(file, encoding) {
- read("readAsText", this, file, encoding);
-};
-
-FileReader.prototype.readAsDataURL = function(file) {
- read("readAsDataURL", this, file);
-};
-
-FileReader.prototype.readAsBinaryString = function(file) {
- read("readAsBinaryString", this, file);
-};
-
-FileReader.prototype.readAsArrayBuffer = function(file) {
- read("readAsArrayBuffer", this, file);
-};
-
-window.FileReader = FileReader;
-module.exports = FileReader;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/blackberry10/FileSystem.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileSystem.js b/www/blackberry10/FileSystem.js
deleted file mode 100644
index d1432d6..0000000
--- a/www/blackberry10/FileSystem.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-module.exports = function(name, root) {
- this.name = name || null;
- if (root) {
- this.root = root;
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/blackberry10/FileWriter.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileWriter.js b/www/blackberry10/FileWriter.js
deleted file mode 100644
index d50efc5..0000000
--- a/www/blackberry10/FileWriter.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var FileError = require('./FileError'),
- ProgressEvent = require('./ProgressEvent'),
- fileUtils = require('./BB10Utils'),
- utils = require('cordova/utils');
-
-function FileWriter (file) {
- var that = this;
- this.file = file;
- this.events = {};
- this.pending = [];
- resolveLocalFileSystemURI(file.fullPath, function (entry) {
- entry.nativeEntry.createWriter(function (writer) {
- var i,
- event;
- that.nativeWriter = writer;
- for (event in that.events) {
- if (that.events.hasOwnProperty(event)) {
- that.nativeWriter[event] = that.events[event];
- }
- }
- for (i = 0; i < that.pending.length; i++) {
- that.pending[i]();
- }
- });
- });
- this.events = {};
- this.pending = [];
-}
-
-utils.defineGetter(FileWriter.prototype, 'error', function() {
- return this.nativeWriter ? this.nativeWriter.error : null;
-});
-
-utils.defineGetter(FileWriter.prototype, 'fileName', function() {
- return this.nativeWriter ? this.nativeWriter.fileName : this.file.name;
-});
-
-utils.defineGetter(FileWriter.prototype, 'length', function() {
- return this.nativeWriter ? this.nativeWriter.length : this.file.size;
-});
-
-utils.defineGetter(FileWriter.prototype, 'position', function() {
- return this.nativeWriter ? this.nativeWriter.position : 0;
-});
-
-utils.defineGetter(FileWriter.prototype, 'readyState', function() {
- return this.nativeWriter ? this.nativeWriter.readyState : 0;
-});
-
-function defineEvent(eventName) {
- utils.defineGetterSetter(FileWriter.prototype, eventName, function() {
- return this.nativeWriter ? this.nativeWriter[eventName] || null : this.events[eventName] || null;
- }, function(value) {
- if (this.nativeWriter) {
- this.nativeWriter[eventName] = value;
- }
- else {
- this.events[eventName] = value;
- }
- });
-}
-
-defineEvent('onabort');
-defineEvent('onerror');
-defineEvent('onprogress');
-defineEvent('onwrite');
-defineEvent('onwriteend');
-defineEvent('onwritestart');
-
-FileWriter.prototype.abort = function() {
- this.nativeWriter.abort();
-};
-
-FileWriter.prototype.write = function(text) {
- var that = this,
- op = function () {
- that.nativeWriter.write(new Blob([text]));
- };
- this.nativeWriter ? op() : this.pending.push(op);
-
-};
-
-FileWriter.prototype.seek = function(offset) {
- var that = this,
- op = function () {
- that.nativeWriter.seek(offset);
- };
- this.nativeWriter ? op() : this.pending.push(op);
-};
-
-FileWriter.prototype.truncate = function(size) {
- var that = this,
- op = function () {
- that.nativeWriter.truncate(size);
- };
- this.nativeWriter ? op() : this.pending.push(op);
-};
-
-module.exports = FileWriter;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/blackberry10/fileUtils.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/fileUtils.js b/www/blackberry10/fileUtils.js
deleted file mode 100644
index 740669c..0000000
--- a/www/blackberry10/fileUtils.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
- */
-
-function convertPath(url) {
- return decodeURI(url).substring(11).replace(/\/$/, '');
-}
-
-module.exports = {
- createEntry: function (entry) {
- var cordovaEntry;
- if (entry.isFile) {
- cordovaEntry = new window.FileEntry(entry.name, entry.fullPath, entry.filesystem);
- } else {
- cordovaEntry = new window.DirectoryEntry(entry.name, entry.fullPath, entry.filesystem);
- }
- cordovaEntry.nativeEntry = entry;
- return cordovaEntry;
- },
-
- createFile: function (file) {
- var cordovaFile = new File(file.name, file.fullPath, file.type, file.lastModifiedDate, file.size);
- cordovaFile.nativeFile = file;
- cordovaFile.fullPath = file.fullPath;
- return cordovaFile;
- },
-
- getFileSystemName: function (fs) {
- return ((fs.name.indexOf('Persistent') != -1) || (fs.name === "persistent")) ? 'persistent' : 'temporary';
- },
-
- isOutsideSandbox: function (path) {
- return (path.indexOf("accounts/1000") !== -1);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/blackberry10/requestFileSystem.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/requestFileSystem.js b/www/blackberry10/requestFileSystem.js
deleted file mode 100644
index 9180801..0000000
--- a/www/blackberry10/requestFileSystem.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var fileUtils = require('./BB10Utils'),
- FileError = require('./FileError'),
- FileSystem = require('./BB10FileSystem');
-
-if (!window.requestAnimationFrame) {
- window.requestAnimationFrame = function (callback) { callback(); };
-}
-
-module.exports = function (type, size, success, fail) {
- var cordovaFs,
- cordovaFsRoot;
- if (size >= 1000000000000000) {
- if (typeof fail === "function") {
- fail(new FileError(FileError.QUOTA_EXCEEDED_ERR));
- }
- } else if (type !== 1 && type !== 0) {
- if (typeof fail === "function") {
- fail(new FileError(FileError.SYNTAX_ERR));
- }
- } else {
- cordova.exec(function () {
- window.requestAnimationFrame(function () {
- window.webkitRequestFileSystem(type, size, function (fs) {
- cordovaFsRoot = fileUtils.createEntry(fs.root);
- cordovaFs = new FileSystem(fileUtils.getFileSystemName(fs), cordovaFsRoot);
- cordovaFsRoot.filesystem = cordovaFs;
- cordovaFs._size = size;
- success(cordovaFs);
- }, function (error) {
- if (typeof fail === "function") {
- fail(new FileError(error));
- }
- });
- });
- }, fail, "org.apache.cordova.file", "setSandbox", [true]);
-
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/blackberry10/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/resolveLocalFileSystemURI.js b/www/blackberry10/resolveLocalFileSystemURI.js
deleted file mode 100644
index 6decdda..0000000
--- a/www/blackberry10/resolveLocalFileSystemURI.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-module.exports = function () {
- console.log("resolveLocalFileSystemURI is deprecated. Please call resolveLocalFileSystemURL instead.");
- window.resolveLocalFileSystemURL.apply(this, arguments);
-};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/blackberry10/resolveLocalFileSystemURL.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/resolveLocalFileSystemURL.js b/www/blackberry10/resolveLocalFileSystemURL.js
deleted file mode 100644
index db64615..0000000
--- a/www/blackberry10/resolveLocalFileSystemURL.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var fileUtils = require('./BB10Utils'),
- FileError = require('./FileError');
-
-if (!window.requestAnimationFrame) {
- window.requestAnimationFrame = function (callback) { callback(); };
-}
-
-module.exports = function (uri, success, fail) {
-
- var decodedURI = decodeURI(uri).replace(/filesystem:/, '').replace(/file:\/\//, ''),
- failNotFound = function () {
- if (fail) {
- fail(FileError.NOT_FOUND_ERR);
- }
- },
- resolveURI = function () {
- window.requestAnimationFrame(function () {
- window.webkitRequestFileSystem(
- window.PERSISTENT,
- 50*1024*1024,
- function (fs) {
- var op = decodedURI.slice(-1) === '/' ? 'getDirectory' : 'getFile';
- fs.root[op](
- decodedURI,
- { create: false },
- function (entry) {
- success(fileUtils.createEntry(entry));
- },
- failNotFound
- );
- },
- failNotFound
- );
- });
- };
-
- if (decodedURI.substring(0, 8) === 'local://') {
- cordova.exec(
- function (path) {
- decodedURI = path;
- resolveURI();
- },
- failNotFound,
- 'org.apache.cordova.file',
- 'resolveLocalPath',
- [decodedURI]
- );
- } else {
- cordova.exec(
- resolveURI,
- failNotFound,
- 'org.apache.cordova.file',
- 'setSandbox',
- [!fileUtils.isOutsideSandbox(decodedURI)]
- );
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/ios/FileSystem.js
----------------------------------------------------------------------
diff --git a/www/ios/FileSystem.js b/www/ios/FileSystem.js
deleted file mode 100644
index b11d58f..0000000
--- a/www/ios/FileSystem.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-FILESYSTEM_PROTOCOL = "cdvfile";
-
-module.exports = {
- __format__: function(fullPath) {
- var path = ('/'+this.name+(fullPath[0]==='/'?'':'/')+encodeURI(fullPath)).replace('//','/');
- return FILESYSTEM_PROTOCOL + '://localhost' + path;
- }
-};
-
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/requestFileSystem.js
----------------------------------------------------------------------
diff --git a/www/requestFileSystem.js b/www/requestFileSystem.js
deleted file mode 100644
index 7a1cc8f..0000000
--- a/www/requestFileSystem.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var argscheck = require('cordova/argscheck'),
- FileError = require('./FileError'),
- FileSystem = require('./FileSystem'),
- exec = require('cordova/exec');
-
-/**
- * Request a file system in which to store application data.
- * @param type local file system type
- * @param size indicates how much storage space, in bytes, the application expects to need
- * @param successCallback invoked with a FileSystem object
- * @param errorCallback invoked if error occurs retrieving file system
- */
-var requestFileSystem = function(type, size, successCallback, errorCallback) {
- argscheck.checkArgs('nnFF', 'requestFileSystem', arguments);
- var fail = function(code) {
- errorCallback && errorCallback(new FileError(code));
- };
-
- if (type < 0) {
- fail(FileError.SYNTAX_ERR);
- } else {
- // if successful, return a FileSystem object
- var success = function(file_system) {
- if (file_system) {
- if (successCallback) {
- // grab the name and root from the file system object
- var result = new FileSystem(file_system.name, file_system.root);
- successCallback(result);
- }
- }
- else {
- // no FileSystem object returned
- fail(FileError.NOT_FOUND_ERR);
- }
- };
- exec(success, fail, "File", "requestFileSystem", [type, size]);
- }
-};
-
-module.exports = requestFileSystem;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/www/resolveLocalFileSystemURI.js b/www/resolveLocalFileSystemURI.js
deleted file mode 100644
index f2fd105..0000000
--- a/www/resolveLocalFileSystemURI.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var argscheck = require('cordova/argscheck'),
- DirectoryEntry = require('./DirectoryEntry'),
- FileEntry = require('./FileEntry'),
- FileError = require('./FileError'),
- exec = require('cordova/exec');
-
-/**
- * Look up file system Entry referred to by local URI.
- * @param {DOMString} uri URI referring to a local file or directory
- * @param successCallback invoked with Entry object corresponding to URI
- * @param errorCallback invoked if error occurs retrieving file system entry
- */
-module.exports.resolveLocalFileSystemURL = function(uri, successCallback, errorCallback) {
- argscheck.checkArgs('sFF', 'resolveLocalFileSystemURI', arguments);
- // error callback
- var fail = function(error) {
- errorCallback && errorCallback(new FileError(error));
- };
- // sanity check for 'not:valid:filename'
- if(!uri || uri.split(":").length > 2) {
- setTimeout( function() {
- fail(FileError.ENCODING_ERR);
- },0);
- return;
- }
- // if successful, return either a file or directory entry
- var success = function(entry) {
- if (entry) {
- if (successCallback) {
- // create appropriate Entry object
- var fsName = entry.filesystemName || (entry.filesystem == window.PERSISTENT ? 'persistent' : 'temporary');
- var fs = new FileSystem(fsName, {name:"", fullPath:"/"});
- var result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath, fs, entry.nativeURL) : new FileEntry(entry.name, entry.fullPath, fs, entry.nativeURL);
- successCallback(result);
- }
- }
- else {
- // no Entry object returned
- fail(FileError.NOT_FOUND_ERR);
- }
- };
-
- exec(success, fail, "File", "resolveLocalFileSystemURI", [uri]);
-};
-module.exports.resolveLocalFileSystemURI = function() {
- console.log("resolveLocalFileSystemURI is deprecated. Please call resolveLocalFileSystemURL instead.");
- module.exports.resolveLocalFileSystemURL.apply(this, arguments);
-};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/ubuntu/DirectoryEntry.js
----------------------------------------------------------------------
diff --git a/www/ubuntu/DirectoryEntry.js b/www/ubuntu/DirectoryEntry.js
deleted file mode 100644
index 80949f0..0000000
--- a/www/ubuntu/DirectoryEntry.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-module.exports = {
- createReader: function() {
- return new DirectoryReader(this.fullPath);
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/ubuntu/Entry.js
----------------------------------------------------------------------
diff --git a/www/ubuntu/Entry.js b/www/ubuntu/Entry.js
deleted file mode 100644
index bb8d43c..0000000
--- a/www/ubuntu/Entry.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-module.exports = {
- toURL:function() {
- // TODO: refactor path in a cross-platform way so we can eliminate
- // these kinds of platform-specific hacks.
- return "file://localhost" + this.fullPath;
- },
- toURI: function() {
- console.log("DEPRECATED: Update your code to use 'toURL'");
- return "file://localhost" + this.fullPath;
- }
-};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/9976b306/www/ubuntu/FileWriter.js
----------------------------------------------------------------------
diff --git a/www/ubuntu/FileWriter.js b/www/ubuntu/FileWriter.js
deleted file mode 100644
index a75506b..0000000
--- a/www/ubuntu/FileWriter.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- *
-*/
-
-var exec = require('cordova/exec'),
- FileError = require('./FileError'),
- ProgressEvent = require('./ProgressEvent');
-
-function write(data) {
- var that=this;
- var supportsBinary = (typeof window.Blob !== 'undefined' && typeof window.ArrayBuffer !== 'undefined');
- var isBinary;
-
- // Check to see if the incoming data is a blob
- if (data instanceof File || (supportsBinary && data instanceof Blob)) {
- var fileReader = new FileReader();
- fileReader.onload = function() {
- // Call this method again, with the arraybuffer as argument
- FileWriter.prototype.write.call(that, this.result);
- };
- if (supportsBinary) {
- fileReader.readAsArrayBuffer(data);
- } else {
- fileReader.readAsText(data);
- }
- return;
- }
-
- // Mark data type for safer transport over the binary bridge
- isBinary = supportsBinary && (data instanceof ArrayBuffer);
-
- // Throw an exception if we are already writing a file
- if (this.readyState === FileWriter.WRITING) {
- throw new FileError(FileError.INVALID_STATE_ERR);
- }
-
- // WRITING state
- this.readyState = FileWriter.WRITING;
-
- var me = this;
-
- // If onwritestart callback
- if (typeof me.onwritestart === "function") {
- me.onwritestart(new ProgressEvent("writestart", {"target":me}));
- }
-
- if (data instanceof ArrayBuffer || data.buffer instanceof ArrayBuffer) {
- data = new Uint8Array(data);
- var binary = "";
- for (var i = 0; i < data.byteLength; i++) {
- binary += String.fromCharCode(data[i]);
- }
- data = binary;
- }
-
- var prefix = "file://localhost";
- var path = this.localURL;
- if (path.substr(0, prefix.length) == prefix) {
- path = path.substr(prefix.length);
- }
- // Write file
- exec(
- // Success callback
- function(r) {
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileWriter.DONE) {
- return;
- }
-
- // position always increases by bytes written because file would be extended
- me.position += r;
- // The length of the file is now where we are done writing.
-
- me.length = me.position;
-
- // DONE state
- me.readyState = FileWriter.DONE;
-
- // If onwrite callback
- if (typeof me.onwrite === "function") {
- me.onwrite(new ProgressEvent("write", {"target":me}));
- }
-
- // If onwriteend callback
- if (typeof me.onwriteend === "function") {
- me.onwriteend(new ProgressEvent("writeend", {"target":me}));
- }
- },
- // Error callback
- function(e) {
- // If DONE (cancelled), then don't do anything
- if (me.readyState === FileWriter.DONE) {
- return;
- }
-
- // DONE state
- me.readyState = FileWriter.DONE;
-
- // Save error
- me.error = new FileError(e);
-
- // If onerror callback
- if (typeof me.onerror === "function") {
- me.onerror(new ProgressEvent("error", {"target":me}));
- }
-
- // If onwriteend callback
- if (typeof me.onwriteend === "function") {
- me.onwriteend(new ProgressEvent("writeend", {"target":me}));
- }
- }, "File", "write", [path, data, this.position, isBinary]);
-};
-
-module.exports = {
- write: write
-};
-
-require("cordova/exec/proxy").add("FileWriter", module.exports);