You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bh...@apache.org on 2014/07/21 21:50:22 UTC
[1/4] git commit: CB-7167 [BlackBerry10] copyTo - return wrapped
entry rather than native
Repository: cordova-plugin-file
Updated Branches:
refs/heads/master 913b9a3cc -> 56976ae25
CB-7167 [BlackBerry10] copyTo - return wrapped entry rather than native
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/56976ae2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/56976ae2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/56976ae2
Branch: refs/heads/master
Commit: 56976ae252f01e05b6c7301c5192b0285e29a143
Parents: 6b09950
Author: Bryan Higgins <bh...@blackberry.com>
Authored: Fri Jul 18 13:01:25 2014 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Fri Jul 18 14:16:45 2014 -0400
----------------------------------------------------------------------
www/blackberry10/copyTo.js | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/56976ae2/www/blackberry10/copyTo.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/copyTo.js b/www/blackberry10/copyTo.js
index ebbce41..36bc8c6 100644
--- a/www/blackberry10/copyTo.js
+++ b/www/blackberry10/copyTo.js
@@ -42,9 +42,15 @@ module.exports = function (success, fail, args, move) {
fileName = args[2],
copiedEntry,
onSuccess = function () {
- if (typeof(success) === 'function') {
- success(copiedEntry);
- }
+ resolve(
+ function (entry) {
+ if (typeof(success) === 'function') {
+ success(entry);
+ }
+ },
+ onFail,
+ [destination + copiedEntry.name]
+ );
},
onFail = function (error) {
if (typeof(fail) === 'function') {
[4/4] git commit: CB-7161 [BlackBerry10] Add file system directory
paths
Posted by bh...@apache.org.
CB-7161 [BlackBerry10] Add file system directory paths
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/75fcc925
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/75fcc925
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/75fcc925
Branch: refs/heads/master
Commit: 75fcc9256ac7a8907c5c7862261fc7cc90d02fea
Parents: 913b9a3
Author: Bryan Higgins <bh...@blackberry.com>
Authored: Thu Jul 17 15:22:22 2014 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Fri Jul 18 14:16:45 2014 -0400
----------------------------------------------------------------------
doc/index.md | 25 +++++++++++++++++-----
plugin.xml | 5 ++++-
src/blackberry10/index.js | 13 +++++++++++
tests/tests.js | 2 ++
www/blackberry10/info.js | 2 +-
www/blackberry10/resolveLocalFileSystemURI.js | 2 +-
www/fileSystemPaths.js | 4 +++-
7 files changed, 44 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/75fcc925/doc/index.md
----------------------------------------------------------------------
diff --git a/doc/index.md b/doc/index.md
index 0b4d3cb..a8bddaa 100644
--- a/doc/index.md
+++ b/doc/index.md
@@ -63,22 +63,22 @@ Each URL is in the form _file:///path/to/spot/_, and can be converted to a
`DirectoryEntry` using `window.resolveLocalFileSystemURL()`.
* `cordova.file.applicationDirectory` - Read-only directory where the application
- is installed. (_iOS_, _Android_)
+ is installed. (_iOS_, _Android_, _BlackBerry 10_)
* `cordova.file.applicationStorageDirectory` - Root directory of the application's
sandbox; on iOS this location is read-only (but specific subdirectories [like
`/Documents`] are read-write). All data contained within is private to the app. (
- _iOS_, _Android_)
+ _iOS_, _Android_, _BlackBerry 10_)
* `cordova.file.dataDirectory` - Persistent and private data storage within the
application's sandbox using internal memory (on Android, if you need to use
external memory, use `.externalDataDirectory`). On iOS, this directory is not
- synced with iCloud (use `.syncedDataDirectory`). (_iOS_, _Android_)
+ synced with iCloud (use `.syncedDataDirectory`). (_iOS_, _Android_, _BlackBerry 10_)
* `cordova.file.cacheDirectory` - Directory for cached data files or any files
that your app can re-create easily. The OS may delete these files when the device
runs low on storage, nevertheless, apps should not rely on the OS to delete files
- in here. (_iOS_, _Android_)
+ in here. (_iOS_, _Android_, _BlackBerry 10_)
* `cordova.file.externalApplicationStorageDirectory` - Application space on
external storage. (_Android_)
@@ -89,7 +89,7 @@ Each URL is in the form _file:///path/to/spot/_, and can be converted to a
* `cordova.file.externalCacheDirectory` - Application cache on external storage.
(_Android_)
-* `cordova.file.externalRootDirectory` - External storage (SD card) root. (_Android_)
+* `cordova.file.externalRootDirectory` - External storage (SD card) root. (_Android_, _BlackBerry 10_)
* `cordova.file.tempDirectory` - Temp directory that the OS can clear at will. Do not
rely on the OS to clear this directory; your app should always remove files as
@@ -101,6 +101,8 @@ Each URL is in the form _file:///path/to/spot/_, and can be converted to a
* `cordova.file.documentsDirectory` - Files private to the app, but that are meaningful
to other application (e.g. Office files). (_iOS_)
+* `cordova.file.sharedDirectory` - Files globally available to all applications (_BlackBerry 10_)
+
## File System Layouts
Although technically an implementation detail, it can be very useful to know how
@@ -160,6 +162,19 @@ the `cordova.file.*` properties map to physical paths on a real device.
**Note**: If external storage can't be mounted, the `cordova.file.external*`
properties are `null`.
+### BlackBerry 10 File System Layout
+
+| Device Path | `cordova.file.*` | r/w? | persistent? | OS clears | private |
+|:-------------------------------------------------------------|:----------------------------|:----:|:-----------:|:---------:|:-------:|
+| `file:///accounts/1000/appdata/<app id>/` | applicationStorageDirectory | r/o | N/A | N/A | Yes |
+| `app/native` | applicationDirectory | r/o | N/A | N/A | Yes |
+| `data/webviews/webfs/temporary/local__0` | cacheDirectory | r/w | No | Yes | Yes |
+| `data/webviews/webfs/persistent/local__0` | dataDirectory | r/w | Yes | No | Yes |
+| `file:///accounts/1000/removable/sdcard` | externalRemovableDirectory | r/w | Yes | No | No |
+| `file:///accounts/1000/shared` | sharedDirectory | r/w | Yes | No | No |
+
+*Note*: When application is deployed to work perimeter, all paths are relative to /accounts/1000-enterprise.
+
## Android Quirks
### Android Persistent storage location
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/75fcc925/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 4e1c233..85e6631 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -278,6 +278,9 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<js-module src="www/fileSystems-roots.js" name="fileSystems-roots">
<runs/>
</js-module>
+ <js-module src="www/fileSystemPaths.js" name="fileSystemPaths">
+ <merges target="cordova" />
+ </js-module>
<js-module src="www/blackberry10/copyTo.js" name="copyToProxy" />
<js-module src="www/blackberry10/getDirectory.js" name="getDirectoryProxy" />
<js-module src="www/blackberry10/getFile.js" name="getFileProxy" />
@@ -298,7 +301,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<js-module src="www/blackberry10/setMetadata.js" name="setMetadataProxy" />
<js-module src="www/blackberry10/truncate.js" name="truncateProxy" />
<js-module src="www/blackberry10/write.js" name="writeProxy" />
- <source-file src="src/blackberry10/index.js" />
+ <source-file src="src/blackberry10/index.js" target-dir="File" />
</platform>
<!-- windows8 -->
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/75fcc925/src/blackberry10/index.js
----------------------------------------------------------------------
diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js
index e8b597c..913ab30 100644
--- a/src/blackberry10/index.js
+++ b/src/blackberry10/index.js
@@ -27,5 +27,18 @@ module.exports = {
getHomePath: function (success, fail, args, env) {
var homeDir = window.qnx.webplatform.getApplication().getEnv("HOME");
new PluginResult(args, env).ok(homeDir);
+ },
+
+ requestAllPaths: function (success, fail, args, env) {
+ var homeDir = 'file://' + window.qnx.webplatform.getApplication().getEnv("HOME").replace('/data', ''),
+ paths = {
+ applicationDirectory: homeDir + '/app/native/',
+ applicationStorageDirectory: homeDir + '/',
+ dataDirectory: homeDir + '/data/webviews/webfs/persistent/local__0/',
+ cacheDirectory: homeDir + '/data/webviews/webfs/temporary/local__0/',
+ externalRootDirectory: 'file:///accounts/1000/removable/sdcard/',
+ sharedDirectory: homeDir + '/shared/'
+ };
+ success(paths);
}
};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/75fcc925/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index ec79cf3..76c8a90 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -3029,6 +3029,8 @@ exports.defineAutoTests = function () {
var expectedPaths = ['applicationDirectory', 'applicationStorageDirectory', 'dataDirectory', 'cacheDirectory'];
if (cordova.platformId == 'android') {
expectedPaths.push('externalApplicationStorageDirectory', 'externalRootDirectory', 'externalCacheDirectory', 'externalDataDirectory');
+ } else if (cordova.platformId == 'blackberry10') {
+ expectedPaths.push('externalRootDirectory', 'sharedDirectory');
} else if (cordova.platformId == 'ios') {
expectedPaths.push('syncedDataDirectory', 'documentsDirectory', 'tempDirectory');
} else {
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/75fcc925/www/blackberry10/info.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/info.js b/www/blackberry10/info.js
index 716dba2..63f9504 100644
--- a/www/blackberry10/info.js
+++ b/www/blackberry10/info.js
@@ -44,7 +44,7 @@ cordova.exec(
function () {
console.error('Unable to determine local storage file path');
},
- 'org.apache.cordova.file',
+ 'File',
'getHomePath',
false
);
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/75fcc925/www/blackberry10/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/resolveLocalFileSystemURI.js b/www/blackberry10/resolveLocalFileSystemURI.js
index a29fe2f..058d76a 100644
--- a/www/blackberry10/resolveLocalFileSystemURI.js
+++ b/www/blackberry10/resolveLocalFileSystemURI.js
@@ -123,7 +123,7 @@ function resolve(success, fail, path, fsType, sandbox, options, size) {
requestAnimationFrame(function () {
resolveNative(success, fail, path, fsType, options, size);
});
- }, fail, 'org.apache.cordova.file', 'setSandbox', [sandbox], false);
+ }, fail, 'File', 'setSandbox', [sandbox], false);
});
}
}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/75fcc925/www/fileSystemPaths.js
----------------------------------------------------------------------
diff --git a/www/fileSystemPaths.js b/www/fileSystemPaths.js
index 8ef0bb8..c332f48 100644
--- a/www/fileSystemPaths.js
+++ b/www/fileSystemPaths.js
@@ -45,7 +45,9 @@ exports.file = {
// iOS: Holds app-specific files that should be synced (e.g. to iCloud).
syncedDataDirectory: null,
// iOS: Files private to the app, but that are meaningful to other applciations (e.g. Office files)
- documentsDirectory: null
+ documentsDirectory: null,
+ // BlackBerry10: Files globally available to all apps
+ sharedDirectory: null
};
channel.waitForInitialization('onFileSystemPathsReady');
[2/4] git commit: CB-7167 [BlackBerry10] Fix tests detection of blob
support (window.Blob is BlobConstructor object)
Posted by bh...@apache.org.
CB-7167 [BlackBerry10] Fix tests detection of blob support (window.Blob is BlobConstructor object)
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/d1ab0d9d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/d1ab0d9d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/d1ab0d9d
Branch: refs/heads/master
Commit: d1ab0d9df8c0b717ff50bb1de9b27c8ae3781f09
Parents: 75fcc92
Author: Bryan Higgins <bh...@blackberry.com>
Authored: Fri Jul 18 11:27:19 2014 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Fri Jul 18 14:16:45 2014 -0400
----------------------------------------------------------------------
tests/tests.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d1ab0d9d/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 76c8a90..2f0178b 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -2408,7 +2408,7 @@ exports.defineAutoTests = function () {
});
it("file.spec.105 should be able to write binary data from a Blob", function (done) {
// Skip test if Blobs are not supported (e.g.: Android 2.3).
- if ((typeof window.Blob != 'function' && typeof window.WebKitBlobBuilder == 'undefined') || typeof window.ArrayBuffer == 'undefined') {
+ if ((typeof window.Blob == 'undefined' && typeof window.WebKitBlobBuilder == 'undefined') || typeof window.ArrayBuffer == 'undefined') {
expect(true).toFailWithMessage('Platform does not supported this feature');
done();
return;
@@ -2544,7 +2544,7 @@ exports.defineAutoTests = function () {
});
it("file.spec.108 should be able to write binary data from a File", function (done) {
// Skip test if Blobs are not supported (e.g.: Android 2.3).
- if (typeof window.Blob != 'function' && typeof window.WebKitBlobBuilder == 'undefined') {
+ if (typeof window.Blob == 'undefined' && typeof window.WebKitBlobBuilder == 'undefined') {
expect(true).toFailWithMessage('Platform does not supported this feature');
done();
}
[3/4] git commit: CB-7167 [BlackBerry10] Add directory support to
getFileMetadata
Posted by bh...@apache.org.
CB-7167 [BlackBerry10] Add directory support to getFileMetadata
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/6b099505
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/6b099505
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/6b099505
Branch: refs/heads/master
Commit: 6b099505d7571abc10411faa39e1e592a441d1b4
Parents: d1ab0d9
Author: Bryan Higgins <bh...@blackberry.com>
Authored: Fri Jul 18 11:30:00 2014 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Fri Jul 18 14:16:45 2014 -0400
----------------------------------------------------------------------
www/blackberry10/getFileMetadata.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/6b099505/www/blackberry10/getFileMetadata.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/getFileMetadata.js b/www/blackberry10/getFileMetadata.js
index 30b256c..dd3c1a5 100644
--- a/www/blackberry10/getFileMetadata.js
+++ b/www/blackberry10/getFileMetadata.js
@@ -55,7 +55,11 @@ module.exports = function (success, fail, args) {
};
resolve(function (entry) {
requestAnimationFrame(function () {
- entry.nativeEntry.file(onSuccess, onFail);
+ if (entry.nativeEntry.file) {
+ entry.nativeEntry.file(onSuccess, onFail);
+ } else {
+ entry.nativeEntry.getMetadata(onSuccess, onFail);
+ }
});
}, onFail, [uri]);
};