mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 08:53:24 +08:00
moveFile handles absolute paths by not pre-pending anything to them
This commit is contained in:
parent
b8e5aaf754
commit
0ae49ed098
@ -167,13 +167,18 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On
|
|||||||
public void moveFile(String file) {
|
public void moveFile(String file) {
|
||||||
/* this is a hack to save the file as the specified name */
|
/* this is a hack to save the file as the specified name */
|
||||||
File f = new File(this.tempFile);
|
File f = new File(this.tempFile);
|
||||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
|
||||||
f.renameTo(new File(Environment.getExternalStorageDirectory().getAbsolutePath()
|
if (!file.startsWith("/")) {
|
||||||
+ File.separator + file));
|
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||||
} else {
|
file = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + file;
|
||||||
f.renameTo(new File("/data/data/" + handler.cordova.getActivity().getPackageName() + "/cache/" + 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user