mirror of
https://github.com/playmusicexporter/playmusicexporter
synced 2024-05-15 03:16:44 +00:00
isAlreadyThere caused an IllegalArgumentException, when called with the default export path without enabling force overwrite.
This commit is contained in:
parent
dc87dc7c4b
commit
86e0b7c02a
|
@ -667,16 +667,22 @@ public class PlayMusicManager {
|
|||
* return true if the file already exists
|
||||
*/
|
||||
private boolean isAlreadyThere(Uri pUri, String pPath) {
|
||||
DocumentFile lDocumentFile = DocumentFile.fromTreeUri(mContext, pUri);
|
||||
for (String lDisplayName: pPath.split("/")) {
|
||||
if (lDocumentFile.findFile(lDisplayName) != null) {
|
||||
lDocumentFile = lDocumentFile.findFile(lDisplayName);
|
||||
} else {
|
||||
Logger.getInstance().logInfo("isAlreadyThere", pPath + " does not exist yet." );
|
||||
return false;
|
||||
if (pUri.toString().startsWith("file://")) {
|
||||
//Old sdcard URI
|
||||
return FileTools.fileExists(pUri.buildUpon().appendPath(pPath).build().toString());
|
||||
} else {
|
||||
//Documents Provider URI
|
||||
DocumentFile lDocumentFile = DocumentFile.fromTreeUri(mContext, pUri);
|
||||
for (String lDisplayName : pPath.split("/")) {
|
||||
if (lDocumentFile.findFile(lDisplayName) != null) {
|
||||
lDocumentFile = lDocumentFile.findFile(lDisplayName);
|
||||
} else {
|
||||
Logger.getInstance().logInfo("isAlreadyThere", pPath + " does not exist yet.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue