import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
+import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.RenameRemoteFileOperation;
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.utils.FileStorageUtils;
-import com.owncloud.android.utils.Log_OC;
import android.accounts.Account;
// 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