From 7ee135e51666cef0ccf465763599b7462b5e43bd Mon Sep 17 00:00:00 2001 From: Fil Maj Date: Thu, 16 Feb 2012 15:18:13 -0800 Subject: [PATCH] Prefix URIs for file API with file:/// and persistent storage should never point to SD card --- framework/src/org/apache/cordova/FileUtils.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/framework/src/org/apache/cordova/FileUtils.java b/framework/src/org/apache/cordova/FileUtils.java index 5c217c23..c3478065 100755 --- a/framework/src/org/apache/cordova/FileUtils.java +++ b/framework/src/org/apache/cordova/FileUtils.java @@ -782,14 +782,14 @@ public class FileUtils extends Plugin { File fp; fs.put("name", "temporary"); if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { - fs.put("root", Environment.getExternalStorageDirectory().getAbsolutePath() + + fs.put("root", "file://" + Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + ctx.getPackageName() + "/cache/"); // Create the cache dir if it doesn't exist. fp = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Android/data/" + ctx.getPackageName() + "/cache/"); } else { - fs.put("root", "/data/data/" + ctx.getPackageName() + "/cache/"); + fs.put("root", "file:///data/data/" + ctx.getPackageName() + "/cache/"); // Create the cache dir if it doesn't exist. fp = new File("/data/data/" + ctx.getPackageName() + "/cache/"); } @@ -797,11 +797,7 @@ public class FileUtils extends Plugin { } else if (type == PERSISTENT) { fs.put("name", "persistent"); - if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { - fs.put("root", Environment.getExternalStorageDirectory()); - } else { - fs.put("root", "/data/data/" + ctx.getPackageName()); - } + fs.put("root", "file:///data/data/" + ctx.getPackageName()); } else { throw new IOException("No filesystem of type requested");