From b8e5aaf754e0f3a73fae1f1694fd56d0cb74a8e8 Mon Sep 17 00:00:00 2001 From: lenny Date: Fri, 1 Mar 2013 21:56:57 -0800 Subject: [PATCH 1/2] ignore IntelliJ files --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index e73b34b3..757a6983 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ Desktop.ini *.swp *.class *.jar +# IntelliJ IDEA files +*.iml +.idea From 0ae49ed098f9202fc3ccf66cfad7fcc0daeb2266 Mon Sep 17 00:00:00 2001 From: lenny Date: Fri, 1 Mar 2013 22:11:29 -0800 Subject: [PATCH 2/2] moveFile handles absolute paths by not pre-pending anything to them --- framework/src/org/apache/cordova/AudioPlayer.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/framework/src/org/apache/cordova/AudioPlayer.java b/framework/src/org/apache/cordova/AudioPlayer.java index 99dbb3d8..01707280 100644 --- a/framework/src/org/apache/cordova/AudioPlayer.java +++ b/framework/src/org/apache/cordova/AudioPlayer.java @@ -167,13 +167,18 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On public void moveFile(String file) { /* this is a hack to save the file as the specified name */ File f = new File(this.tempFile); - if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { - f.renameTo(new File(Environment.getExternalStorageDirectory().getAbsolutePath() - + File.separator + file)); - } else { - f.renameTo(new File("/data/data/" + handler.cordova.getActivity().getPackageName() + "/cache/" + file)); + + if (!file.startsWith("/")) { + if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { + file = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + file; + } else { + file = "/data/data/" + handler.cordova.getActivity().getPackageName() + "/cache/" + file; + } } + String logMsg = "renaming " + this.tempFile + " to " + file; + Log.d(LOG_TAG, logMsg); + if (!f.renameTo(new File(file))) Log.e(LOG_TAG, "FAILED " + logMsg); } /**