X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/7d9fc6857e1d534c1930b94b6063f1e21a827e9b..0f39ff841a65d49778abf915b8730bce734bd960:/src/com/owncloud/android/operations/RenameFileOperation.java diff --git a/src/com/owncloud/android/operations/RenameFileOperation.java b/src/com/owncloud/android/operations/RenameFileOperation.java index 95a5a9ba..178c4d39 100644 --- a/src/com/owncloud/android/operations/RenameFileOperation.java +++ b/src/com/owncloud/android/operations/RenameFileOperation.java @@ -134,12 +134,19 @@ public class RenameFileOperation extends SyncOperation { // try to rename the local copy of the file if (mFile.isDown()) { - File f = new File(mFile.getStoragePath()); + String oldPath = mFile.getStoragePath(); + File f = new File(oldPath); String parentStoragePath = f.getParent(); if (!parentStoragePath.endsWith(File.separator)) parentStoragePath += File.separator; if (f.renameTo(new File(parentStoragePath + mNewName))) { - mFile.setStoragePath(parentStoragePath + mNewName); + String newPath = parentStoragePath + mNewName; + mFile.setStoragePath(newPath); + + // notify MediaScanner about removed file - TODO really works? + getStorageManager().triggerMediaScan(oldPath); + // notify to scan about new file + getStorageManager().triggerMediaScan(newPath); } // else - NOTHING: the link to the local file is kept although the local name can't be updated // TODO - study conditions when this could be a problem