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/23 20:57:12 UTC
[16/37] git commit: CB-6242 [BlackBerry10] Add deprecated version of
resolveLocalFileSystemURI
CB-6242 [BlackBerry10] Add deprecated version of resolveLocalFileSystemURI
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/d9189f96
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/d9189f96
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/d9189f96
Branch: refs/heads/master
Commit: d9189f96ebe3c00008436aa0b79abcb0bc7aa840
Parents: 9ec3b64
Author: Bryan Higgins <bh...@blackberry.com>
Authored: Tue Mar 18 14:24:28 2014 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Tue Mar 18 14:24:28 2014 -0400
----------------------------------------------------------------------
plugin.xml | 4 +-
www/blackberry10/resolveLocalFileSystemURI.js | 59 +---------------
www/blackberry10/resolveLocalFileSystemURL.js | 78 ++++++++++++++++++++++
3 files changed, 84 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d9189f96/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index db2721f..b1f2729 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -256,9 +256,11 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<clobbers target="window.requestFileSystem" />
</js-module>
<js-module src="www/blackberry10/resolveLocalFileSystemURI.js" name="BB10resolveLocalFileSystemURI">
+ <clobbers target="window.resolveLocalFileSystemURI" />
+ </js-module>
+ <js-module src="www/blackberry10/resolveLocalFileSystemURL.js" name="BB10resolveLocalFileSystemURL">
<clobbers target="window.resolveLocalFileSystemURL" />
</js-module>
-
<source-file src="src/blackberry10/index.js"></source-file>
</platform>
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d9189f96/www/blackberry10/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/resolveLocalFileSystemURI.js b/www/blackberry10/resolveLocalFileSystemURI.js
index db64615..6decdda 100644
--- a/www/blackberry10/resolveLocalFileSystemURI.js
+++ b/www/blackberry10/resolveLocalFileSystemURI.js
@@ -19,60 +19,7 @@
*
*/
-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)]
- );
- }
+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/d9189f96/www/blackberry10/resolveLocalFileSystemURL.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/resolveLocalFileSystemURL.js b/www/blackberry10/resolveLocalFileSystemURL.js
new file mode 100644
index 0000000..db64615
--- /dev/null
+++ b/www/blackberry10/resolveLocalFileSystemURL.js
@@ -0,0 +1,78 @@
+/*
+ *
+ * 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)]
+ );
+ }
+};