- OCFile currentDir = getCurrentDir();
- if (synchFolderRemotePath != null) {
-
- OCFile synchDir = getStorageManager().getFileByPath(synchFolderRemotePath);
- boolean needToRefresh = false;
- if (synchDir == null) {
- Log_OC.e(TAG, "SEARCHING NEW CURRENT");
- // after synchronizing the current folder does not exist (was deleted in the server) ; need to move to other
- String synchPath = synchFolderRemotePath;
- do {
- String synchParentPath = new File(synchPath).getParent();
- synchParentPath = synchParentPath.endsWith(OCFile.PATH_SEPARATOR) ? synchParentPath : synchParentPath + OCFile.PATH_SEPARATOR;
- synchDir = getStorageManager().getFileByPath(synchParentPath);
- popDirname();
- synchPath = synchParentPath;
- } while (synchDir == null); // sooner of later will get ROOT, that never is null
- currentDir = synchDir;
-
- Toast.makeText(FileDisplayActivity.this,
- String.format(getString(R.string.sync_current_folder_was_removed), synchPath),
- Toast.LENGTH_LONG).show();
- needToRefresh = true;
- }
+ if (currentDir == null) {
+ // current folder was removed from the server
+ Toast.makeText( FileDisplayActivity.this,
+ String.format(getString(R.string.sync_current_folder_was_removed), mDirectories.getItem(0)),
+ Toast.LENGTH_LONG)
+ .show();
+ onBackPressed();