You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/09/27 00:26:01 UTC
[01/14] git commit: [CB-4752] Incremented plugin version on dev
branch.
Updated Branches:
refs/heads/master 1fb457704 -> 0e2ce7be5
[CB-4752] Incremented plugin version on dev branch.
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/6a2565dc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/6a2565dc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/6a2565dc
Branch: refs/heads/master
Commit: 6a2565dcbcecce98fec67244d745aaa685a91083
Parents: 1fb4577
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Sep 6 00:58:22 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Sep 6 00:58:22 2013 -0400
----------------------------------------------------------------------
plugin.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/6a2565dc/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 5d2d222..d378c36 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -3,7 +3,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="org.apache.cordova.core.file"
- version="0.2.1">
+ version="0.2.2-dev">
<name>File</name>
<description>Cordova File Plugin</description>
<license>Apache 2.0</license>
[03/14] git commit: [CB-4763] Copy FileHelper.java into the plugin.
Posted by st...@apache.org.
[CB-4763] Copy FileHelper.java into the plugin.
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/885d8a01
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/885d8a01
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/885d8a01
Branch: refs/heads/master
Commit: 885d8a01ad42c5fd33c6d4883cb779ddd5592c0c
Parents: 73a8604
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Sep 9 15:08:04 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Sep 9 15:33:33 2013 -0400
----------------------------------------------------------------------
plugin.xml | 1 +
src/android/FileHelper.java | 162 +++++++++++++++++++++++++++++++++++++++
src/android/FileUtils.java | 1 -
3 files changed, 163 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/885d8a01/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index f08ca60..367e419 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -95,6 +95,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<source-file src="src/android/NoModificationAllowedException.java" target-dir="src/org/apache/cordova/file" />
<source-file src="src/android/TypeMismatchException.java" target-dir="src/org/apache/cordova/file" />
<source-file src="src/android/FileUtils.java" target-dir="src/org/apache/cordova/file" />
+ <source-file src="src/android/FileHelper.java" target-dir="src/org/apache/cordova/file" />
</platform>
<!-- ios -->
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/885d8a01/src/android/FileHelper.java
----------------------------------------------------------------------
diff --git a/src/android/FileHelper.java b/src/android/FileHelper.java
new file mode 100644
index 0000000..b266444
--- /dev/null
+++ b/src/android/FileHelper.java
@@ -0,0 +1,162 @@
+/*
+ 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.
+ */
+package org.apache.cordova.file;
+
+import android.database.Cursor;
+import android.net.Uri;
+import android.webkit.MimeTypeMap;
+
+import org.apache.cordova.CordovaInterface;
+import org.apache.cordova.LOG;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.charset.Charset;
+import java.util.Locale;
+
+public class FileHelper {
+ private static final String LOG_TAG = "FileUtils";
+ private static final String _DATA = "_data";
+
+ /**
+ * Returns the real path of the given URI string.
+ * If the given URI string represents a content:// URI, the real path is retrieved from the media store.
+ *
+ * @param uriString the URI string of the audio/image/video
+ * @param cordova the current application context
+ * @return the full path to the file
+ */
+ @SuppressWarnings("deprecation")
+ public static String getRealPath(String uriString, CordovaInterface cordova) {
+ String realPath = null;
+
+ if (uriString.startsWith("content://")) {
+ String[] proj = { _DATA };
+ Cursor cursor = cordova.getActivity().managedQuery(Uri.parse(uriString), proj, null, null, null);
+ int column_index = cursor.getColumnIndexOrThrow(_DATA);
+ cursor.moveToFirst();
+ realPath = cursor.getString(column_index);
+ if (realPath == null) {
+ LOG.e(LOG_TAG, "Could get real path for URI string %s", uriString);
+ }
+ } else if (uriString.startsWith("file://")) {
+ realPath = uriString.substring(7);
+ if (realPath.startsWith("/android_asset/")) {
+ LOG.e(LOG_TAG, "Cannot get real path for URI string %s because it is a file:///android_asset/ URI.", uriString);
+ realPath = null;
+ }
+ } else {
+ realPath = uriString;
+ }
+
+ return realPath;
+ }
+
+ /**
+ * Returns the real path of the given URI.
+ * If the given URI is a content:// URI, the real path is retrieved from the media store.
+ *
+ * @param uri the URI of the audio/image/video
+ * @param cordova the current application context
+ * @return the full path to the file
+ */
+ public static String getRealPath(Uri uri, CordovaInterface cordova) {
+ return FileHelper.getRealPath(uri.toString(), cordova);
+ }
+
+ /**
+ * Returns an input stream based on given URI string.
+ *
+ * @param uriString the URI string from which to obtain the input stream
+ * @param cordova the current application context
+ * @return an input stream into the data at the given URI or null if given an invalid URI string
+ * @throws IOException
+ */
+ public static InputStream getInputStreamFromUriString(String uriString, CordovaInterface cordova) throws IOException {
+ if (uriString.startsWith("content")) {
+ Uri uri = Uri.parse(uriString);
+ return cordova.getActivity().getContentResolver().openInputStream(uri);
+ } else if (uriString.startsWith("file://")) {
+ int question = uriString.indexOf("?");
+ if (question > -1) {
+ uriString = uriString.substring(0,question);
+ }
+ if (uriString.startsWith("file:///android_asset/")) {
+ Uri uri = Uri.parse(uriString);
+ String relativePath = uri.getPath().substring(15);
+ return cordova.getActivity().getAssets().open(relativePath);
+ } else {
+ return new FileInputStream(getRealPath(uriString, cordova));
+ }
+ } else {
+ return new FileInputStream(getRealPath(uriString, cordova));
+ }
+ }
+
+ /**
+ * Removes the "file://" prefix from the given URI string, if applicable.
+ * If the given URI string doesn't have a "file://" prefix, it is returned unchanged.
+ *
+ * @param uriString the URI string to operate on
+ * @return a path without the "file://" prefix
+ */
+ public static String stripFileProtocol(String uriString) {
+ if (uriString.startsWith("file://")) {
+ uriString = uriString.substring(7);
+ }
+ return uriString;
+ }
+
+ public static String getMimeTypeForExtension(String path) {
+ String extension = path;
+ int lastDot = extension.lastIndexOf('.');
+ if (lastDot != -1) {
+ extension = extension.substring(lastDot + 1);
+ }
+ // Convert the URI string to lower case to ensure compatibility with MimeTypeMap (see CB-2185).
+ extension = extension.toLowerCase(Locale.getDefault());
+ if (extension.equals("3ga")) {
+ return "audio/3gpp";
+ }
+ return MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
+ }
+
+ /**
+ * Returns the mime type of the data specified by the given URI string.
+ *
+ * @param uriString the URI string of the data
+ * @return the mime type of the specified data
+ */
+ public static String getMimeType(String uriString, CordovaInterface cordova) {
+ String mimeType = null;
+
+ Uri uri = Uri.parse(uriString);
+ if (uriString.startsWith("content://")) {
+ mimeType = cordova.getActivity().getContentResolver().getType(uri);
+ } else {
+ mimeType = getMimeTypeForExtension(uri.getPath());
+ }
+
+ return mimeType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/885d8a01/src/android/FileUtils.java
----------------------------------------------------------------------
diff --git a/src/android/FileUtils.java b/src/android/FileUtils.java
index a42b9cc..6f3bc89 100755
--- a/src/android/FileUtils.java
+++ b/src/android/FileUtils.java
@@ -29,7 +29,6 @@ import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.PluginResult;
import org.apache.cordova.DirectoryManager;
-import org.apache.cordova.FileHelper;
import org.json.JSONArray;
import org.json.JSONException;
[05/14] git commit: Fix compiler/lint warnings
Posted by st...@apache.org.
Fix compiler/lint warnings
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/4d24eeee
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/4d24eeee
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/4d24eeee
Branch: refs/heads/master
Commit: 4d24eeee15c27fc75d32b6de1981909dbf743cd5
Parents: 93c652e
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Sep 9 16:22:16 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Sep 9 16:22:16 2013 -0400
----------------------------------------------------------------------
src/android/DirectoryManager.java | 5 ++---
src/android/EncodingException.java | 1 +
src/android/FileExistsException.java | 1 +
src/android/FileHelper.java | 4 ----
src/android/InvalidModificationException.java | 1 +
src/android/NoModificationAllowedException.java | 1 +
src/android/TypeMismatchException.java | 1 +
7 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/4d24eeee/src/android/DirectoryManager.java
----------------------------------------------------------------------
diff --git a/src/android/DirectoryManager.java b/src/android/DirectoryManager.java
index b201811..c2d1278 100644
--- a/src/android/DirectoryManager.java
+++ b/src/android/DirectoryManager.java
@@ -18,12 +18,11 @@
*/
package org.apache.cordova.file;
-import java.io.File;
-
-import android.content.Context;
import android.os.Environment;
import android.os.StatFs;
+import java.io.File;
+
/**
* This class provides file directory utilities.
* All file operations are performed on the SD card.
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/4d24eeee/src/android/EncodingException.java
----------------------------------------------------------------------
diff --git a/src/android/EncodingException.java b/src/android/EncodingException.java
index a32e18e..e9e1653 100644
--- a/src/android/EncodingException.java
+++ b/src/android/EncodingException.java
@@ -19,6 +19,7 @@
package org.apache.cordova.file;
+@SuppressWarnings("serial")
public class EncodingException extends Exception {
public EncodingException(String message) {
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/4d24eeee/src/android/FileExistsException.java
----------------------------------------------------------------------
diff --git a/src/android/FileExistsException.java b/src/android/FileExistsException.java
index 18aa7ea..5c4d83d 100644
--- a/src/android/FileExistsException.java
+++ b/src/android/FileExistsException.java
@@ -19,6 +19,7 @@
package org.apache.cordova.file;
+@SuppressWarnings("serial")
public class FileExistsException extends Exception {
public FileExistsException(String msg) {
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/4d24eeee/src/android/FileHelper.java
----------------------------------------------------------------------
diff --git a/src/android/FileHelper.java b/src/android/FileHelper.java
index b266444..9e8b626 100644
--- a/src/android/FileHelper.java
+++ b/src/android/FileHelper.java
@@ -26,12 +26,8 @@ import org.apache.cordova.CordovaInterface;
import org.apache.cordova.LOG;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.charset.Charset;
import java.util.Locale;
public class FileHelper {
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/4d24eeee/src/android/InvalidModificationException.java
----------------------------------------------------------------------
diff --git a/src/android/InvalidModificationException.java b/src/android/InvalidModificationException.java
index aebab4d..8f6bec5 100644
--- a/src/android/InvalidModificationException.java
+++ b/src/android/InvalidModificationException.java
@@ -20,6 +20,7 @@
package org.apache.cordova.file;
+@SuppressWarnings("serial")
public class InvalidModificationException extends Exception {
public InvalidModificationException(String message) {
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/4d24eeee/src/android/NoModificationAllowedException.java
----------------------------------------------------------------------
diff --git a/src/android/NoModificationAllowedException.java b/src/android/NoModificationAllowedException.java
index 8cae115..627eafb 100644
--- a/src/android/NoModificationAllowedException.java
+++ b/src/android/NoModificationAllowedException.java
@@ -19,6 +19,7 @@
package org.apache.cordova.file;
+@SuppressWarnings("serial")
public class NoModificationAllowedException extends Exception {
public NoModificationAllowedException(String message) {
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/4d24eeee/src/android/TypeMismatchException.java
----------------------------------------------------------------------
diff --git a/src/android/TypeMismatchException.java b/src/android/TypeMismatchException.java
index 0ea5993..1315f9a 100644
--- a/src/android/TypeMismatchException.java
+++ b/src/android/TypeMismatchException.java
@@ -20,6 +20,7 @@
package org.apache.cordova.file;
+@SuppressWarnings("serial")
public class TypeMismatchException extends Exception {
public TypeMismatchException(String message) {
[02/14] git commit: [CB-2901] [BlackBerry10] Automatically unsandbox
filesystem if path is not in app sandbox
Posted by st...@apache.org.
[CB-2901] [BlackBerry10] Automatically unsandbox filesystem if path is not in app sandbox
Reviewed by Bryan Higgins <bh...@blackberry.com>
Tested by Tracy Li <tl...@blackberry.com>
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/73a8604d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/73a8604d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/73a8604d
Branch: refs/heads/master
Commit: 73a8604dd4e7ef7700adaef723babcdf550ecf34
Parents: 6a2565d
Author: Hasan Ahmad <ha...@blackberry.com>
Authored: Mon Jul 8 12:35:29 2013 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Fri Sep 6 09:00:35 2013 -0400
----------------------------------------------------------------------
plugin.xml | 41 +++++++------
src/blackberry10/index.js | 10 +++
www/blackberry10/DirectoryEntry.js | 71 +++++++++++++++++++---
www/blackberry10/DirectoryReader.js | 19 ++++--
www/blackberry10/Entry.js | 12 +++-
www/blackberry10/File.js | 54 ++++++++++++++++
www/blackberry10/FileEntry.js | 10 +--
www/blackberry10/FileReader.js | 2 +-
www/blackberry10/FileWriter.js | 2 +-
www/blackberry10/fileUtils.js | 19 +++---
www/blackberry10/requestFileSystem.js | 8 ++-
www/blackberry10/resolveLocalFileSystemURI.js | 54 ++++++++--------
12 files changed, 227 insertions(+), 75 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/73a8604d/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index d378c36..f08ca60 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -12,14 +12,14 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<js-module src="www/DirectoryEntry.js" name="DirectoryEntry">
<clobbers target="window.DirectoryEntry" />
</js-module>
-
+
<js-module src="www/DirectoryReader.js" name="DirectoryReader">
<clobbers target="window.DirectoryReader" />
- </js-module>
-
+ </js-module>
+
<js-module src="www/Entry.js" name="Entry">
<clobbers target="window.Entry" />
- </js-module>
+ </js-module>
<js-module src="www/File.js" name="File">
<clobbers target="window.File" />
@@ -40,11 +40,11 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<js-module src="www/FileSystem.js" name="FileSystem">
<clobbers target="window.FileSystem" />
</js-module>
-
+
<js-module src="www/FileUploadOptions.js" name="FileUploadOptions">
<clobbers target="window.FileUploadOptions" />
</js-module>
-
+
<js-module src="www/FileUploadResult.js" name="FileUploadResult">
<clobbers target="window.FileUploadResult" />
</js-module>
@@ -52,15 +52,15 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<js-module src="www/FileWriter.js" name="FileWriter">
<clobbers target="window.FileWriter" />
</js-module>
-
+
<js-module src="www/Flags.js" name="Flags">
<clobbers target="window.Flags" />
- </js-module>
+ </js-module>
<js-module src="www/LocalFileSystem.js" name="LocalFileSystem">
<clobbers target="window.LocalFileSystem" />
</js-module>
-
+
<js-module src="www/Metadata.js" name="Metadata">
<clobbers target="window.Metadata" />
</js-module>
@@ -72,11 +72,11 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<js-module src="www/requestFileSystem.js" name="requestFileSystem">
<clobbers target="window.requestFileSystem" />
</js-module>
-
+
<js-module src="www/resolveLocalFileSystemURI.js" name="resolveLocalFileSystemURI">
<clobbers target="window.resolveLocalFileSystemURI" />
</js-module>
-
+
<!-- android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
@@ -96,25 +96,25 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<source-file src="src/android/TypeMismatchException.java" target-dir="src/org/apache/cordova/file" />
<source-file src="src/android/FileUtils.java" target-dir="src/org/apache/cordova/file" />
</platform>
-
+
<!-- ios -->
- <platform name="ios">
+ <platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="File">
- <param name="ios-package" value="CDVFile" />
+ <param name="ios-package" value="CDVFile" />
</feature>
</config-file>
<header-file src="src/ios/CDVFile.h" />
<source-file src="src/ios/CDVFile.m" />
-
+
<!-- ios specific file apis -->
<js-module src="www/ios/Entry.js" name="Entry1">
<merges target="window.Entry" />
</js-module>
-
+
<framework src="AssetsLibrary.framework" />
<framework src="MobileCoreServices.framework" />
- </platform>
+ </platform>
<!-- wp7 -->
<platform name="wp7">
@@ -164,7 +164,10 @@ xmlns:android="http://schemas.android.com/apk/res/android"
</js-module>
<js-module src="www/blackberry10/Entry.js" name="BB10Entry">
<clobbers target="window.Entry" />
- </js-module>
+ </js-module>
+ <js-module src="www/blackberry10/File.js" name="BB10File">
+ <clobbers target="window.File" />
+ </js-module>
<js-module src="www/blackberry10/FileEntry.js" name="BB10FileEntry">
<clobbers target="window.FileEntry" />
</js-module>
@@ -183,6 +186,8 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<js-module src="www/blackberry10/resolveLocalFileSystemURI.js" name="BB10resolveLocalFileSystemURI">
<clobbers target="window.resolveLocalFileSystemURI" />
</js-module>
+
+ <source-file src="src/blackberry10/index.js"></source-file>
</platform>
<!-- windows8 -->
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/73a8604d/src/blackberry10/index.js
----------------------------------------------------------------------
diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js
new file mode 100644
index 0000000..914d966
--- /dev/null
+++ b/src/blackberry10/index.js
@@ -0,0 +1,10 @@
+module.exports = {
+ setSandbox : function (success, fail, args, env) {
+ require("lib/webview").setSandbox(JSON.parse(decodeURIComponent(args[0])));
+ new PluginResult(args, env).noResult(false);
+ },
+
+ isSandboxed : function (success, fail, args, env) {
+ new PluginResult(args, env).ok(require("lib/webview").getSandbox() === "1");
+ }
+};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/73a8604d/www/blackberry10/DirectoryEntry.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/DirectoryEntry.js b/www/blackberry10/DirectoryEntry.js
index 15289a7..295f88e 100644
--- a/www/blackberry10/DirectoryEntry.js
+++ b/www/blackberry10/DirectoryEntry.js
@@ -25,21 +25,52 @@ var argscheck = require('cordova/argscheck'),
FileError = require('./FileError'),
DirectoryReader = require('./BB10DirectoryReader'),
fileUtils = require('./BB10Utils'),
- DirectoryEntry = function (name, fullPath) {
- DirectoryEntry.__super__.constructor.call(this, false, true, name, fullPath);
+ DirectoryEntry = function (name, fullPath, fileSystem) {
+ DirectoryEntry.__super__.constructor.call(this, false, true, name, fullPath, fileSystem);
};
utils.extend(DirectoryEntry, Entry);
+function err(sandboxState, errorCallback) {
+ return function (e) {
+ cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [sandboxState]);
+ errorCallback(e);
+ }
+};
+
DirectoryEntry.prototype.createReader = function () {
return new DirectoryReader(this.fullPath);
};
DirectoryEntry.prototype.getDirectory = function (path, options, successCallback, errorCallback) {
+ var sandboxState,
+ currentPath = this.nativeEntry.fullPath;
+
+ cordova.exec(function (sandboxed) {
+ sandboxState = sandboxed;
+ }, function (e) {
+ console.log("[ERROR]: Could not retrieve sandbox state ", e);
+ }, "org.apache.cordova.core.file", "isSandboxed");
+
argscheck.checkArgs('sOFF', 'DirectoryEntry.getDirectory', arguments);
- this.nativeEntry.getDirectory(path, options, function (entry) {
- successCallback(fileUtils.createEntry(entry));
- }, errorCallback);
+
+ if (fileUtils.isOutsideSandbox(path)) {
+ cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [false]);
+ window.webkitRequestFileSystem(window.PERSISTENT, this.filesystem._size, function (fs) {
+ cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [sandboxState]);
+ fs.root.getDirectory(currentPath + '/' + path, options, function (entry) {
+ successCallback(fileUtils.createEntry(entry));
+ }, err(sandboxState, errorCallback));
+ }, err(sandboxState, errorCallback));
+ } else {
+ cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [true]);
+ window.webkitRequestFileSystem(fileUtils.getFileSystemName(this.filesystem) === "persistent" ? window.PERSISTENT : window.TEMPORARY, this.filesystem._size, function (fs) {
+ cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [sandboxState]);
+ fs.root.getDirectory(currentPath + '/' + path, options, function (entry) {
+ successCallback(fileUtils.createEntry(entry));
+ }, err(sandboxState, errorCallback));
+ }, err(sandboxState, errorCallback));
+ }
};
DirectoryEntry.prototype.removeRecursively = function (successCallback, errorCallback) {
@@ -48,10 +79,34 @@ DirectoryEntry.prototype.removeRecursively = function (successCallback, errorCal
};
DirectoryEntry.prototype.getFile = function (path, options, successCallback, errorCallback) {
+ var sandboxState,
+ currentPath = this.nativeEntry.fullPath;
+
+ cordova.exec(function (sandboxed) {
+ sandboxState = sandboxed;
+ }, function (e) {
+ console.log("[ERROR]: Could not retrieve sandbox state ", e);
+ }, "org.apache.cordova.core.file", "isSandboxed");
+
argscheck.checkArgs('sOFF', 'DirectoryEntry.getFile', arguments);
- this.nativeEntry.getFile(path, options, function (entry) {
- successCallback(fileUtils.createEntry(entry));
- }, errorCallback);
+
+ if (fileUtils.isOutsideSandbox(path)) {
+ cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [false]);
+ window.webkitRequestFileSystem(window.PERSISTENT, this.filesystem._size, function (fs) {
+ cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [sandboxState]);
+ fs.root.getFile(currentPath + '/' + path, options, function (entry) {
+ successCallback(fileUtils.createEntry(entry));
+ }, err(sandboxState, errorCallback));
+ }, err(sandboxState, errorCallback));
+ } else {
+ cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [true]);
+ window.webkitRequestFileSystem(fileUtils.getFileSystemName(this.filesystem) === "persistent" ? window.PERSISTENT: window.TEMPORARY, this.filesystem._size, function (fs) {
+ cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [sandboxState]);
+ fs.root.getFile(currentPath + '/' + path, options, function (entry) {
+ successCallback(fileUtils.createEntry(entry));
+ }, err(sandboxState, errorCallback));
+ }, err(sandboxState, errorCallback));
+ }
};
module.exports = DirectoryEntry;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/73a8604d/www/blackberry10/DirectoryReader.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/DirectoryReader.js b/www/blackberry10/DirectoryReader.js
index a188545..6aa3d73 100644
--- a/www/blackberry10/DirectoryReader.js
+++ b/www/blackberry10/DirectoryReader.js
@@ -24,10 +24,12 @@ var FileError = require('./FileError'),
function DirectoryReader(path) {
this.path = path;
+ this.nativeReader = null;
}
DirectoryReader.prototype.readEntries = function(successCallback, errorCallback) {
- var win = typeof successCallback !== 'function' ? null : function(result) {
+ 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]));
@@ -37,11 +39,16 @@ DirectoryReader.prototype.readEntries = function(successCallback, errorCallback)
fail = typeof errorCallback !== 'function' ? null : function(code) {
errorCallback(new FileError(code));
};
- fileUtils.getEntryForURI(this.path, function (entry) {
- entry.nativeEntry.createReader().readEntries(win, fail);
- }, function () {
- fail(FileError.NOT_FOUND_ERR);
- });
+ 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/73a8604d/www/blackberry10/Entry.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/Entry.js b/www/blackberry10/Entry.js
index 6bad13c..d432bfd 100644
--- a/www/blackberry10/Entry.js
+++ b/www/blackberry10/Entry.js
@@ -25,10 +25,14 @@ var argscheck = require('cordova/argscheck'),
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 = fullPath || '';
+ this.fullPath = typeof strippedPath !== "undefined" ? strippedPath : (fullPath || '');
this.filesystem = fileSystem || null;
}
@@ -88,7 +92,11 @@ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallbac
};
Entry.prototype.toURL = function() {
- return this.fullPath;
+ var nativeURI = this.nativeEntry.toURL();
+ if (nativeURI.charAt(nativeURI.length - 1) === '/') {
+ return nativeURI.slice(0, -1);
+ }
+ return nativeURI;
};
Entry.prototype.toURI = function(mimeType) {
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/73a8604d/www/blackberry10/File.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/File.js b/www/blackberry10/File.js
new file mode 100644
index 0000000..0ed39fd
--- /dev/null
+++ b/www/blackberry10/File.js
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+/**
+ * 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/73a8604d/www/blackberry10/FileEntry.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileEntry.js b/www/blackberry10/FileEntry.js
index 55927cd..b358d71 100644
--- a/www/blackberry10/FileEntry.js
+++ b/www/blackberry10/FileEntry.js
@@ -22,10 +22,11 @@
var utils = require('cordova/utils'),
Entry = require('./BB10Entry'),
FileWriter = require('./BB10FileWriter'),
- File = require('./File'),
+ File = require('./BB10File'),
+ fileUtils = require('./BB10Utils'),
FileError = require('./FileError'),
- FileEntry = function (name, fullPath) {
- FileEntry.__super__.constructor.apply(this, [true, false, name, fullPath]);
+ FileEntry = function (name, fullPath, fileSystem) {
+ FileEntry.__super__.constructor.apply(this, [true, false, name, fullPath, fileSystem]);
};
utils.extend(FileEntry, Entry);
@@ -39,7 +40,8 @@ FileEntry.prototype.createWriter = function(successCallback, errorCallback) {
FileEntry.prototype.file = function(successCallback, errorCallback) {
var fullPath = this.fullPath,
success = function (file) {
- successCallback(new File(file.name, fullPath, file.type, file.lastModifiedDate, file.size));
+ file.fullPath = fullPath;
+ successCallback(fileUtils.createFile(file));
};
this.nativeEntry.file(success, errorCallback);
};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/73a8604d/www/blackberry10/FileReader.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileReader.js b/www/blackberry10/FileReader.js
index 8210137..6e3a10c 100644
--- a/www/blackberry10/FileReader.js
+++ b/www/blackberry10/FileReader.js
@@ -60,7 +60,7 @@ FileReader.prototype.abort = function() {
function read(method, context, file, encoding) {
if (file.fullPath) {
- fileUtils.getEntryForURI(file.fullPath, function (entry) {
+ resolveLocalFileSystemURI("filesystem:local:///persistent/" + file.fullPath, function (entry) {
entry.nativeEntry.file(function (nativeFile) {
context.nativeReader[method].call(context.nativeReader, nativeFile, encoding);
}, context.onerror);
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/73a8604d/www/blackberry10/FileWriter.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileWriter.js b/www/blackberry10/FileWriter.js
index 4c7521d..8992943 100644
--- a/www/blackberry10/FileWriter.js
+++ b/www/blackberry10/FileWriter.js
@@ -29,7 +29,7 @@ function FileWriter (file) {
this.file = file;
this.events = {};
this.pending = [];
- fileUtils.getEntryForURI(file.fullPath, function (entry) {
+ resolveLocalFileSystemURI("filesystem:local:///persistent/" + file.fullPath, function (entry) {
entry.nativeEntry.createWriter(function (writer) {
var i,
event;
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/73a8604d/www/blackberry10/fileUtils.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/fileUtils.js b/www/blackberry10/fileUtils.js
index e26e4e9..6f803b7 100644
--- a/www/blackberry10/fileUtils.js
+++ b/www/blackberry10/fileUtils.js
@@ -24,24 +24,29 @@ function convertPath(url) {
}
module.exports = {
-
createEntry: function (entry) {
var cordovaEntry;
if (entry.isFile) {
- cordovaEntry = new window.FileEntry(entry.name, convertPath(entry.toURL()));
+ cordovaEntry = new window.FileEntry(entry.name, entry.fullPath, entry.filesystem);
} else {
- cordovaEntry = new window.DirectoryEntry(entry.name, convertPath(entry.toURL()));
+ cordovaEntry = new window.DirectoryEntry(entry.name, entry.fullPath, entry.filesystem);
}
cordovaEntry.nativeEntry = entry;
return cordovaEntry;
},
- getEntryForURI: function (uri, success, fail) {
- //TODO: account for local vs file system
- window.resolveLocalFileSystemURI(uri, success, fail);
+ createFile: function (file) {
+ var cordovaFile = new File(file.name, file.fullPath, file.type, file.lastModifiedDate, file.size);
+ cordovaFile.nativeFile = file;
+ cordovaFile.fullPath = file.name;
+ return cordovaFile;
},
getFileSystemName: function (fs) {
- return (fs.name.indexOf('Persistent') != -1) ? 'persistent' : 'temporary';
+ return ((fs.name.indexOf('Persistent') != -1) || (fs.name === "persistent")) ? 'persistent' : 'temporary';
+ },
+
+ isOutsideSandbox: function (path) {
+ return (path.indexOf("accounts/1000/") === 0 || path.indexOf("/accounts/1000/") === 0);
}
};
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/73a8604d/www/blackberry10/requestFileSystem.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/requestFileSystem.js b/www/blackberry10/requestFileSystem.js
index bb97564..bd07d08 100644
--- a/www/blackberry10/requestFileSystem.js
+++ b/www/blackberry10/requestFileSystem.js
@@ -24,13 +24,19 @@ var fileUtils = require('./BB10Utils'),
FileSystem = require('./BB10FileSystem');
module.exports = function (type, size, success, fail) {
+ var cordovaFs,
+ cordovaFsRoot;
if (size >= 1000000000000000) {
fail(new FileError(FileError.QUOTA_EXCEEDED_ERR));
} else if (type !== 1 && type !== 0) {
fail(new FileError(FileError.SYNTAX_ERR));
} else {
window.webkitRequestFileSystem(type, size, function (fs) {
- success((new FileSystem(fileUtils.getFileSystemName(fs), fileUtils.createEntry(fs.root))));
+ cordovaFsRoot = fileUtils.createEntry(fs.root);
+ cordovaFs = new FileSystem(fileUtils.getFileSystemName(fs), cordovaFsRoot);
+ cordovaFsRoot.filesystem = cordovaFs;
+ cordovaFs._size = size;
+ success(cordovaFs);
}, function (error) {
fail(new FileError(error));
});
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/73a8604d/www/blackberry10/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/resolveLocalFileSystemURI.js b/www/blackberry10/resolveLocalFileSystemURI.js
index 02e9e6c..06c1f73 100644
--- a/www/blackberry10/resolveLocalFileSystemURI.js
+++ b/www/blackberry10/resolveLocalFileSystemURI.js
@@ -22,34 +22,34 @@
var fileUtils = require('./BB10Utils'),
FileError = require('./FileError');
+function stripURI(uri) {
+ var rmFsLocal = uri.substring("filesystem:local:///".length);
+ return rmFsLocal.substring(rmFsLocal.indexOf('/') + 1);
+}
+
module.exports = function (uri, success, fail) {
- var type,
- path,
- paramPath;
- if (!uri || uri.indexOf("/") === 0) {
- fail(new FileError(FileError.ENCODING_ERR));
+ var sandboxState,
+ decodedURI = decodeURI(uri);
+
+ cordova.exec(function (sandboxed) {
+ sandboxState = sandboxed;
+ }, function (e) {
+ console.log("[ERROR]: Could not retrieve sandbox state ", e);
+ }, "org.apache.cordova.core.file", "isSandboxed");
+
+ if (fileUtils.isOutsideSandbox(stripURI(decodedURI))) {
+ cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [false]);
} else {
- type = uri.indexOf("persistent") === -1 ? 0 : 1;
- path = uri.substring(type === 1 ? uri.indexOf("persistent") + 11 : uri.indexOf("temporary") + 10);
- if (path.substring(0,1) == "/") {
- path = path.substring(1);
- }
- paramPath = path.indexOf("?");
- if (paramPath > -1) {
- path = path.substring(0, paramPath);
- }
- window.webkitRequestFileSystem(type, 25*1024*1024, function (fs) {
- if (path === "") {
- success(fileUtils.createEntry(fs.root));
- } else {
- fs.root.getDirectory(path, {}, function (entry) {
- success(fileUtils.createEntry(entry));
- }, function () {
- fs.root.getFile(path, {}, function (entry) {
- success(fileUtils.createEntry(entry));
- }, fail);
- });
- }
- }, fail);
+ cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [true]);
}
+ window.webkitResolveLocalFileSystemURL(decodedURI, function (entry) {
+ success(fileUtils.createEntry(entry));
+ }, function (e) {
+ window.webkitResolveLocalFileSystemURL(decodedURI + '/', function (entry) {
+ success(fileUtils.createEntry(entry));
+ }, function (e) {
+ fail(e);
+ });
+ });
+ cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [sandboxState]);
};
[08/14] git commit: CB-4889 renaming org.apache.cordova.core.file to
org.apache.cordova.file
Posted by st...@apache.org.
CB-4889 renaming org.apache.cordova.core.file to org.apache.cordova.file
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/f8de9f8f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/f8de9f8f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/f8de9f8f
Branch: refs/heads/master
Commit: f8de9f8ff0fdcd4189d0e3abe940d51543243d89
Parents: 371ae8c
Author: Anis Kadri <an...@apache.org>
Authored: Sat Sep 21 12:22:16 2013 +0200
Committer: Anis Kadri <an...@apache.org>
Committed: Sat Sep 21 12:22:16 2013 +0200
----------------------------------------------------------------------
plugin.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f8de9f8f/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 458798e..394492c 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -2,8 +2,8 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
- id="org.apache.cordova.core.file"
- version="0.2.2-dev">
+ id="org.apache.cordova.file"
+ version="0.2.2">
<name>File</name>
<description>Cordova File Plugin</description>
<license>Apache 2.0</license>
[09/14] git commit: [CB-4903] File Plugin not loading Windows8
Posted by st...@apache.org.
[CB-4903] File Plugin not loading Windows8
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/f8a310cf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/f8a310cf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/f8a310cf
Branch: refs/heads/master
Commit: f8a310cff122d52d4eda3458c8e06b86f812139b
Parents: 371ae8c
Author: Carlos Santana <cs...@gmail.com>
Authored: Tue Sep 24 18:12:44 2013 -0400
Committer: Carlos Santana <cs...@gmail.com>
Committed: Tue Sep 24 18:12:44 2013 -0400
----------------------------------------------------------------------
src/windows8/FileProxy.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f8a310cf/src/windows8/FileProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/FileProxy.js b/src/windows8/FileProxy.js
index 6da9dd0..1445ae7 100644
--- a/src/windows8/FileProxy.js
+++ b/src/windows8/FileProxy.js
@@ -842,4 +842,4 @@ module.exports = {
};
-require("cordova/commandProxy").add("File",module.exports);
+require("cordova/windows8/commandProxy").add("File",module.exports);
[11/14] git commit: [CB-4903] File Plugin not loading Windows8
Posted by st...@apache.org.
[CB-4903] File Plugin not loading Windows8
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/12403736
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/12403736
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/12403736
Branch: refs/heads/master
Commit: 1240373609cb8ee189dcaab894d053ff8f04d104
Parents: 14da0cc
Author: Carlos Santana <cs...@gmail.com>
Authored: Tue Sep 24 18:12:44 2013 -0400
Committer: Anis Kadri <an...@apache.org>
Committed: Wed Sep 25 16:19:11 2013 +0200
----------------------------------------------------------------------
src/windows8/FileProxy.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/12403736/src/windows8/FileProxy.js
----------------------------------------------------------------------
diff --git a/src/windows8/FileProxy.js b/src/windows8/FileProxy.js
index 6da9dd0..1445ae7 100644
--- a/src/windows8/FileProxy.js
+++ b/src/windows8/FileProxy.js
@@ -842,4 +842,4 @@ module.exports = {
};
-require("cordova/commandProxy").add("File",module.exports);
+require("cordova/windows8/commandProxy").add("File",module.exports);
[12/14] git commit: Merge branch 'dev' of
https://git-wip-us.apache.org/repos/asf/cordova-plugin-file into dev
Posted by st...@apache.org.
Merge branch 'dev' of https://git-wip-us.apache.org/repos/asf/cordova-plugin-file into dev
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/a90e68dc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/a90e68dc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/a90e68dc
Branch: refs/heads/master
Commit: a90e68dc3c3074735f857345bacaa73c996c4f8d
Parents: 1240373 f8a310c
Author: Anis Kadri <an...@apache.org>
Authored: Wed Sep 25 16:19:19 2013 +0200
Committer: Anis Kadri <an...@apache.org>
Committed: Wed Sep 25 16:19:19 2013 +0200
----------------------------------------------------------------------
----------------------------------------------------------------------
[14/14] git commit: [CB-4915] Updated version and RELEASENOTES.md for
release 0.2.3
Posted by st...@apache.org.
[CB-4915] Updated version and RELEASENOTES.md for release 0.2.3
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/0e2ce7be
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/0e2ce7be
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/0e2ce7be
Branch: refs/heads/master
Commit: 0e2ce7be57607b87d852ae55d6508d2651b5c8ed
Parents: 40678cc
Author: Steven Gill <st...@gmail.com>
Authored: Wed Sep 25 17:36:53 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Sep 25 17:36:53 2013 -0700
----------------------------------------------------------------------
RELEASENOTES.md | 14 ++++++++++++++
plugin.xml | 2 +-
2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/0e2ce7be/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index 9239ecb..81a1e7b 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -24,3 +24,17 @@
* [CB-4656] Don't add newlines in data urls within readAsDataUrl.
* [CB-4514] Making DirectoryCopy Recursive
* [iOS] Simplify the code in resolveLocalFileSystemURI
+
+### 0.2.3 (Sept 25, 2013)
+* CB-4889 bumping&resetting version
+* [CB-4903] File Plugin not loading Windows8
+* [CB-4903] File Plugin not loading Windows8
+* CB-4889 renaming references
+* CB-4889 renaming org.apache.cordova.core.file to org.apache.cordova.file
+* Rename CHANGELOG.md -> RELEASENOTES.md
+* [CB-4771] Expose TEMPORARY and PERSISTENT constants on window.
+* Fix compiler/lint warnings
+* [CB-4764] Move DirectoryManager.java into file plugin
+* [CB-4763] Copy FileHelper.java into the plugin.
+* [CB-2901] [BlackBerry10] Automatically unsandbox filesystem if path is not in app sandbox
+* [CB-4752] Incremented plugin version on dev branch.
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/0e2ce7be/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index d92bd42..1dfe453 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -3,7 +3,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="org.apache.cordova.file"
- version="0.2.3-dev">
+ version="0.2.3">
<name>File</name>
<description>Cordova File Plugin</description>
<license>Apache 2.0</license>
[07/14] git commit: Rename CHANGELOG.md -> RELEASENOTES.md
Posted by st...@apache.org.
Rename CHANGELOG.md -> RELEASENOTES.md
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/371ae8ce
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/371ae8ce
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/371ae8ce
Branch: refs/heads/master
Commit: 371ae8cedd228e2789597ad4f68442d7103921e3
Parents: d20b0ac
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Sep 17 11:36:13 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Sep 17 11:36:13 2013 -0400
----------------------------------------------------------------------
CHANGELOG.md | 26 --------------------------
RELEASENOTES.md | 26 ++++++++++++++++++++++++++
2 files changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/371ae8ce/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 9239ecb..0000000
--- a/CHANGELOG.md
+++ /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.
-#
--->
-# Release Notes
-
-### 0.2.1 (Sept 5, 2013)
-* [CB-4656] Don't add newlines in data urls within readAsDataUrl.
-* [CB-4514] Making DirectoryCopy Recursive
-* [iOS] Simplify the code in resolveLocalFileSystemURI
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/371ae8ce/RELEASENOTES.md
----------------------------------------------------------------------
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
new file mode 100644
index 0000000..9239ecb
--- /dev/null
+++ b/RELEASENOTES.md
@@ -0,0 +1,26 @@
+<!--
+#
+# 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.
+#
+-->
+# Release Notes
+
+### 0.2.1 (Sept 5, 2013)
+* [CB-4656] Don't add newlines in data urls within readAsDataUrl.
+* [CB-4514] Making DirectoryCopy Recursive
+* [iOS] Simplify the code in resolveLocalFileSystemURI
[06/14] git commit: [CB-4771] Expose TEMPORARY and PERSISTENT
constants on window.
Posted by st...@apache.org.
[CB-4771] Expose TEMPORARY and PERSISTENT constants on window.
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/d20b0ac5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/d20b0ac5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/d20b0ac5
Branch: refs/heads/master
Commit: d20b0ac58bc9354686c3f6c883fa063d13071cf0
Parents: 4d24eee
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Sep 10 13:43:52 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Sep 10 13:43:52 2013 -0400
----------------------------------------------------------------------
plugin.xml | 3 +++
www/LocalFileSystem.js | 15 ++-------------
2 files changed, 5 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d20b0ac5/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index f2ab922..458798e 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -58,7 +58,10 @@ xmlns:android="http://schemas.android.com/apk/res/android"
</js-module>
<js-module src="www/LocalFileSystem.js" name="LocalFileSystem">
+ <!-- Non-standards way -->
<clobbers target="window.LocalFileSystem" />
+ <!-- Standards-compliant way -->
+ <merges target="window" />
</js-module>
<js-module src="www/Metadata.js" name="Metadata">
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/d20b0ac5/www/LocalFileSystem.js
----------------------------------------------------------------------
diff --git a/www/LocalFileSystem.js b/www/LocalFileSystem.js
index dae7683..1e8f2ee 100644
--- a/www/LocalFileSystem.js
+++ b/www/LocalFileSystem.js
@@ -19,16 +19,5 @@
*
*/
-var exec = require('cordova/exec');
-
-/**
- * Represents a local file system.
- */
-var LocalFileSystem = function() {
-
-};
-
-LocalFileSystem.TEMPORARY = 0; //temporary, with no guarantee of persistence
-LocalFileSystem.PERSISTENT = 1; //persistent
-
-module.exports = LocalFileSystem;
+exports.TEMPORARY = 0;
+exports.PERSISTENT = 1;
[10/14] git commit: CB-4889 renaming references
Posted by st...@apache.org.
CB-4889 renaming references
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/14da0cca
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/14da0cca
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/14da0cca
Branch: refs/heads/master
Commit: 14da0cca01bbbfda1fce73b23124279861729d5f
Parents: f8de9f8
Author: Anis Kadri <an...@apache.org>
Authored: Wed Sep 25 16:18:49 2013 +0200
Committer: Anis Kadri <an...@apache.org>
Committed: Wed Sep 25 16:18:49 2013 +0200
----------------------------------------------------------------------
www/Entry.js | 4 ++--
www/blackberry10/DirectoryEntry.js | 22 +++++++++++-----------
www/blackberry10/resolveLocalFileSystemURI.js | 8 ++++----
3 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/14da0cca/www/Entry.js
----------------------------------------------------------------------
diff --git a/www/Entry.js b/www/Entry.js
index c4985dc..0e1bc02 100644
--- a/www/Entry.js
+++ b/www/Entry.js
@@ -107,7 +107,7 @@ Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallbac
if (entry) {
if (successCallback) {
// create appropriate Entry object
- var result = (entry.isDirectory) ? new (require('./DirectoryEntry'))(entry.name, entry.fullPath) : new (require('org.apache.cordova.core.file.FileEntry'))(entry.name, entry.fullPath);
+ var result = (entry.isDirectory) ? new (require('./DirectoryEntry'))(entry.name, entry.fullPath) : new (require('org.apache.cordova.file.FileEntry'))(entry.name, entry.fullPath);
successCallback(result);
}
}
@@ -148,7 +148,7 @@ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallbac
if (entry) {
if (successCallback) {
// create appropriate Entry object
- var result = (entry.isDirectory) ? new (require('./DirectoryEntry'))(entry.name, entry.fullPath) : new (require('org.apache.cordova.core.file.FileEntry'))(entry.name, entry.fullPath);
+ var result = (entry.isDirectory) ? new (require('./DirectoryEntry'))(entry.name, entry.fullPath) : new (require('org.apache.cordova.file.FileEntry'))(entry.name, entry.fullPath);
successCallback(result);
}
}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/14da0cca/www/blackberry10/DirectoryEntry.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/DirectoryEntry.js b/www/blackberry10/DirectoryEntry.js
index 295f88e..cb6628d 100644
--- a/www/blackberry10/DirectoryEntry.js
+++ b/www/blackberry10/DirectoryEntry.js
@@ -33,7 +33,7 @@ utils.extend(DirectoryEntry, Entry);
function err(sandboxState, errorCallback) {
return function (e) {
- cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [sandboxState]);
+ cordova.exec(null, null, "org.apache.cordova.file", "setSandbox", [sandboxState]);
errorCallback(e);
}
};
@@ -50,22 +50,22 @@ DirectoryEntry.prototype.getDirectory = function (path, options, successCallback
sandboxState = sandboxed;
}, function (e) {
console.log("[ERROR]: Could not retrieve sandbox state ", e);
- }, "org.apache.cordova.core.file", "isSandboxed");
+ }, "org.apache.cordova.file", "isSandboxed");
argscheck.checkArgs('sOFF', 'DirectoryEntry.getDirectory', arguments);
if (fileUtils.isOutsideSandbox(path)) {
- cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [false]);
+ cordova.exec(null, null, "org.apache.cordova.file", "setSandbox", [false]);
window.webkitRequestFileSystem(window.PERSISTENT, this.filesystem._size, function (fs) {
- cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [sandboxState]);
+ cordova.exec(null, null, "org.apache.cordova.file", "setSandbox", [sandboxState]);
fs.root.getDirectory(currentPath + '/' + path, options, function (entry) {
successCallback(fileUtils.createEntry(entry));
}, err(sandboxState, errorCallback));
}, err(sandboxState, errorCallback));
} else {
- cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [true]);
+ cordova.exec(null, null, "org.apache.cordova.file", "setSandbox", [true]);
window.webkitRequestFileSystem(fileUtils.getFileSystemName(this.filesystem) === "persistent" ? window.PERSISTENT : window.TEMPORARY, this.filesystem._size, function (fs) {
- cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [sandboxState]);
+ cordova.exec(null, null, "org.apache.cordova.file", "setSandbox", [sandboxState]);
fs.root.getDirectory(currentPath + '/' + path, options, function (entry) {
successCallback(fileUtils.createEntry(entry));
}, err(sandboxState, errorCallback));
@@ -86,22 +86,22 @@ DirectoryEntry.prototype.getFile = function (path, options, successCallback, err
sandboxState = sandboxed;
}, function (e) {
console.log("[ERROR]: Could not retrieve sandbox state ", e);
- }, "org.apache.cordova.core.file", "isSandboxed");
+ }, "org.apache.cordova.file", "isSandboxed");
argscheck.checkArgs('sOFF', 'DirectoryEntry.getFile', arguments);
if (fileUtils.isOutsideSandbox(path)) {
- cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [false]);
+ cordova.exec(null, null, "org.apache.cordova.file", "setSandbox", [false]);
window.webkitRequestFileSystem(window.PERSISTENT, this.filesystem._size, function (fs) {
- cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [sandboxState]);
+ cordova.exec(null, null, "org.apache.cordova.file", "setSandbox", [sandboxState]);
fs.root.getFile(currentPath + '/' + path, options, function (entry) {
successCallback(fileUtils.createEntry(entry));
}, err(sandboxState, errorCallback));
}, err(sandboxState, errorCallback));
} else {
- cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [true]);
+ cordova.exec(null, null, "org.apache.cordova.file", "setSandbox", [true]);
window.webkitRequestFileSystem(fileUtils.getFileSystemName(this.filesystem) === "persistent" ? window.PERSISTENT: window.TEMPORARY, this.filesystem._size, function (fs) {
- cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [sandboxState]);
+ cordova.exec(null, null, "org.apache.cordova.file", "setSandbox", [sandboxState]);
fs.root.getFile(currentPath + '/' + path, options, function (entry) {
successCallback(fileUtils.createEntry(entry));
}, err(sandboxState, errorCallback));
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/14da0cca/www/blackberry10/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/resolveLocalFileSystemURI.js b/www/blackberry10/resolveLocalFileSystemURI.js
index 06c1f73..4d5af61 100644
--- a/www/blackberry10/resolveLocalFileSystemURI.js
+++ b/www/blackberry10/resolveLocalFileSystemURI.js
@@ -35,12 +35,12 @@ module.exports = function (uri, success, fail) {
sandboxState = sandboxed;
}, function (e) {
console.log("[ERROR]: Could not retrieve sandbox state ", e);
- }, "org.apache.cordova.core.file", "isSandboxed");
+ }, "org.apache.cordova.file", "isSandboxed");
if (fileUtils.isOutsideSandbox(stripURI(decodedURI))) {
- cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [false]);
+ cordova.exec(null, null, "org.apache.cordova.file", "setSandbox", [false]);
} else {
- cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [true]);
+ cordova.exec(null, null, "org.apache.cordova.file", "setSandbox", [true]);
}
window.webkitResolveLocalFileSystemURL(decodedURI, function (entry) {
success(fileUtils.createEntry(entry));
@@ -51,5 +51,5 @@ module.exports = function (uri, success, fail) {
fail(e);
});
});
- cordova.exec(null, null, "org.apache.cordova.core.file", "setSandbox", [sandboxState]);
+ cordova.exec(null, null, "org.apache.cordova.file", "setSandbox", [sandboxState]);
};
[04/14] git commit: [CB-4764] Move DirectoryManager.java into file
plugin
Posted by st...@apache.org.
[CB-4764] Move DirectoryManager.java into file plugin
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/93c652e9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/93c652e9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/93c652e9
Branch: refs/heads/master
Commit: 93c652e9c5e87fab50a946c3ccf96a8d2064e897
Parents: 885d8a0
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Sep 9 16:04:08 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Sep 9 16:04:08 2013 -0400
----------------------------------------------------------------------
plugin.xml | 1 +
src/android/DirectoryManager.java | 134 +++++++++++++++++++++++++++++++++
src/android/FileUtils.java | 1 -
3 files changed, 135 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/93c652e9/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 367e419..f2ab922 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -96,6 +96,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<source-file src="src/android/TypeMismatchException.java" target-dir="src/org/apache/cordova/file" />
<source-file src="src/android/FileUtils.java" target-dir="src/org/apache/cordova/file" />
<source-file src="src/android/FileHelper.java" target-dir="src/org/apache/cordova/file" />
+ <source-file src="src/android/DirectoryManager.java" target-dir="src/org/apache/cordova/file" />
</platform>
<!-- ios -->
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/93c652e9/src/android/DirectoryManager.java
----------------------------------------------------------------------
diff --git a/src/android/DirectoryManager.java b/src/android/DirectoryManager.java
new file mode 100644
index 0000000..b201811
--- /dev/null
+++ b/src/android/DirectoryManager.java
@@ -0,0 +1,134 @@
+/*
+ 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.
+*/
+package org.apache.cordova.file;
+
+import java.io.File;
+
+import android.content.Context;
+import android.os.Environment;
+import android.os.StatFs;
+
+/**
+ * This class provides file directory utilities.
+ * All file operations are performed on the SD card.
+ *
+ * It is used by the FileUtils class.
+ */
+public class DirectoryManager {
+
+ @SuppressWarnings("unused")
+ private static final String LOG_TAG = "DirectoryManager";
+
+ /**
+ * Determine if a file or directory exists.
+ * @param name The name of the file to check.
+ * @return T=exists, F=not found
+ */
+ public static boolean testFileExists(String name) {
+ boolean status;
+
+ // If SD card exists
+ if ((testSaveLocationExists()) && (!name.equals(""))) {
+ File path = Environment.getExternalStorageDirectory();
+ File newPath = constructFilePaths(path.toString(), name);
+ status = newPath.exists();
+ }
+ // If no SD card
+ else {
+ status = false;
+ }
+ return status;
+ }
+
+ /**
+ * Get the free disk space
+ *
+ * @return Size in KB or -1 if not available
+ */
+ public static long getFreeDiskSpace(boolean checkInternal) {
+ String status = Environment.getExternalStorageState();
+ long freeSpace = 0;
+
+ // If SD card exists
+ if (status.equals(Environment.MEDIA_MOUNTED)) {
+ freeSpace = freeSpaceCalculation(Environment.getExternalStorageDirectory().getPath());
+ }
+ else if (checkInternal) {
+ freeSpace = freeSpaceCalculation("/");
+ }
+ // If no SD card and we haven't been asked to check the internal directory then return -1
+ else {
+ return -1;
+ }
+
+ return freeSpace;
+ }
+
+ /**
+ * Given a path return the number of free KB
+ *
+ * @param path to the file system
+ * @return free space in KB
+ */
+ private static long freeSpaceCalculation(String path) {
+ StatFs stat = new StatFs(path);
+ long blockSize = stat.getBlockSize();
+ long availableBlocks = stat.getAvailableBlocks();
+ return availableBlocks * blockSize / 1024;
+ }
+
+ /**
+ * Determine if SD card exists.
+ *
+ * @return T=exists, F=not found
+ */
+ public static boolean testSaveLocationExists() {
+ String sDCardStatus = Environment.getExternalStorageState();
+ boolean status;
+
+ // If SD card is mounted
+ if (sDCardStatus.equals(Environment.MEDIA_MOUNTED)) {
+ status = true;
+ }
+
+ // If no SD card
+ else {
+ status = false;
+ }
+ return status;
+ }
+
+ /**
+ * Create a new file object from two file paths.
+ *
+ * @param file1 Base file path
+ * @param file2 Remaining file path
+ * @return File object
+ */
+ private static File constructFilePaths (String file1, String file2) {
+ File newPath;
+ if (file2.startsWith(file1)) {
+ newPath = new File(file2);
+ }
+ else {
+ newPath = new File(file1 + "/" + file2);
+ }
+ return newPath;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/93c652e9/src/android/FileUtils.java
----------------------------------------------------------------------
diff --git a/src/android/FileUtils.java b/src/android/FileUtils.java
index 6f3bc89..405eb83 100755
--- a/src/android/FileUtils.java
+++ b/src/android/FileUtils.java
@@ -28,7 +28,6 @@ import android.util.Log;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.PluginResult;
-import org.apache.cordova.DirectoryManager;
import org.json.JSONArray;
import org.json.JSONException;
[13/14] git commit: CB-4889 bumping&resetting version
Posted by st...@apache.org.
CB-4889 bumping&resetting version
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/40678ccd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/40678ccd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/40678ccd
Branch: refs/heads/master
Commit: 40678ccd58831d28dc5184891e5ada4c63eaf316
Parents: a90e68d
Author: Anis Kadri <an...@apache.org>
Authored: Wed Sep 25 17:50:14 2013 +0200
Committer: Anis Kadri <an...@apache.org>
Committed: Wed Sep 25 17:50:14 2013 +0200
----------------------------------------------------------------------
plugin.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/40678ccd/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index 394492c..d92bd42 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -3,7 +3,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="org.apache.cordova.file"
- version="0.2.2">
+ version="0.2.3-dev">
<name>File</name>
<description>Cordova File Plugin</description>
<license>Apache 2.0</license>