mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 02:17:43 +03:00
Fix: File can not be shown after several actions
This commit is contained in:
parent
6f84897197
commit
9a9d4e0677
1 changed files with 16 additions and 9 deletions
|
@ -467,8 +467,7 @@ public class FileDataStorageManager {
|
||||||
success = removeFolderInDb(folder);
|
success = removeFolderInDb(folder);
|
||||||
}
|
}
|
||||||
if (removeLocalContent && success) {
|
if (removeLocalContent && success) {
|
||||||
File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, folder));
|
success = removeLocalFolder(folder);
|
||||||
success = removeLocalFolder(localFolder);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
|
@ -491,20 +490,28 @@ public class FileDataStorageManager {
|
||||||
return deleted > 0;
|
return deleted > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean removeLocalFolder(File folder) {
|
private boolean removeLocalFolder(OCFile folder) {
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
if (folder.exists()) {
|
File localFolder = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, folder));
|
||||||
File[] files = folder.listFiles();
|
if (localFolder.exists()) {
|
||||||
|
Vector<OCFile> files = getFolderContent(folder.getFileId());
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
for (File file : files) {
|
for (OCFile file : files) {
|
||||||
if (file.isDirectory()) {
|
if (file.isFolder()) {
|
||||||
success &= removeLocalFolder(file);
|
success &= removeLocalFolder(file);
|
||||||
} else {
|
} else {
|
||||||
success &= file.delete();
|
if (file.isDown()) {
|
||||||
|
File localFile = new File(file.getStoragePath());
|
||||||
|
success &= localFile.delete();
|
||||||
|
if (success) {
|
||||||
|
file.setStoragePath(null);
|
||||||
|
saveFile(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
success &= folder.delete();
|
}
|
||||||
|
}
|
||||||
|
success &= localFolder.delete();
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue