|
@@ -491,7 +491,7 @@ public class FileDataStorageManager {
|
|
if (removeLocalCopy && file.isDown() && localPath != null && success) {
|
|
if (removeLocalCopy && file.isDown() && localPath != null && success) {
|
|
success = new File(localPath).delete();
|
|
success = new File(localPath).delete();
|
|
if (success) {
|
|
if (success) {
|
|
- triggerMediaScan(localPath);
|
|
|
|
|
|
+ triggerMediaScan(FileStorageUtils.getParentPath(localPath));
|
|
}
|
|
}
|
|
if (!removeDBData && success) {
|
|
if (!removeDBData && success) {
|
|
// maybe unnecessary, but should be checked TODO remove if unnecessary
|
|
// maybe unnecessary, but should be checked TODO remove if unnecessary
|
|
@@ -539,7 +539,8 @@ public class FileDataStorageManager {
|
|
|
|
|
|
private boolean removeLocalFolder(OCFile folder) {
|
|
private boolean removeLocalFolder(OCFile folder) {
|
|
boolean success = true;
|
|
boolean success = true;
|
|
- File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, folder));
|
|
|
|
|
|
+ String localFolderPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, folder);
|
|
|
|
+ File localFolder = new File(localFolderPath);
|
|
if (localFolder.exists()) {
|
|
if (localFolder.exists()) {
|
|
// stage 1: remove the local files already registered in the files database
|
|
// stage 1: remove the local files already registered in the files database
|
|
Vector<OCFile> files = getFolderContent(folder.getFileId());
|
|
Vector<OCFile> files = getFolderContent(folder.getFileId());
|
|
@@ -549,17 +550,16 @@ public class FileDataStorageManager {
|
|
success &= removeLocalFolder(file);
|
|
success &= removeLocalFolder(file);
|
|
} else {
|
|
} else {
|
|
if (file.isDown()) {
|
|
if (file.isDown()) {
|
|
- String path = file.getStoragePath();
|
|
|
|
File localFile = new File(file.getStoragePath());
|
|
File localFile = new File(file.getStoragePath());
|
|
success &= localFile.delete();
|
|
success &= localFile.delete();
|
|
if (success) {
|
|
if (success) {
|
|
file.setStoragePath(null);
|
|
file.setStoragePath(null);
|
|
saveFile(file);
|
|
saveFile(file);
|
|
- triggerMediaScan(path); // notify MediaScanner about removed file
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ triggerMediaScan(localFolderPath); // notify MediaScanner about removed file in folder
|
|
}
|
|
}
|
|
|
|
|
|
// stage 2: remove the folder itself and any local file inside out of sync;
|
|
// stage 2: remove the folder itself and any local file inside out of sync;
|