Bug fixed (and some refactoring): crash on local removal of a folder

This commit is contained in:
David A. Velasco 2014-12-02 11:17:47 +01:00
parent c20d7ef4ad
commit 0f39ff841a
2 changed files with 6 additions and 7 deletions

View file

@ -486,8 +486,12 @@ public class FileDataStorageManager {
}
success &= (deleted > 0);
}
if (removeLocalCopy && file.isDown() && file.getStoragePath() != null && success) {
success = new File(file.getStoragePath()).delete();
String localPath = file.getStoragePath();
if (removeLocalCopy && file.isDown() && localPath != null && success) {
success = new File(localPath).delete();
if (success) {
triggerMediaScan(localPath);
}
if (!removeDBData && success) {
// maybe unnecessary, but should be checked TODO remove if unnecessary
file.setStoragePath(null);

View file

@ -96,7 +96,6 @@ implements ConfirmationDialogFragmentListener {
FileDataStorageManager storageManager = cg.getStorageManager();
if (storageManager.getFileById(mTargetFile.getFileId()) != null) {
cg.getFileOperationsHelper().removeFile(mTargetFile, false);
storageManager.triggerMediaScan(mTargetFile.getStoragePath());
}
}
@ -105,7 +104,6 @@ implements ConfirmationDialogFragmentListener {
*/
@Override
public void onNeutral(String callerTag) {
String path = mTargetFile.getStoragePath();
ComponentsGetter cg = (ComponentsGetter)getSherlockActivity();
cg.getFileOperationsHelper().removeFile(mTargetFile, true);
@ -135,9 +133,6 @@ implements ConfirmationDialogFragmentListener {
folder.setEtag("");
storageManager.saveFile(folder);
}
// Trigger MediaScan
storageManager.triggerMediaScan(path);
}
@Override