-/* ownCloud Android client application
- * Copyright (C) 2012-2014 ownCloud Inc.
+/**
+ * ownCloud Android client application
+ *
+ * @author David A. Velasco
+ * @author masensio
+ * Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.utils.FileStorageUtils;
-import android.accounts.Account;
-
/**
* Remote operation performing the rename of a remote file (or folder?) in the ownCloud server.
- *
- * @author David A. Velasco
- * @author masensio
*/
public class RenameFileOperation extends SyncOperation {
* Constructor
*
* @param remotePath RemotePath of the OCFile instance describing the remote file or folder to rename
- * @param account OwnCloud account containing the remote file
* @param newName New name to set as the name of file.
*/
public RenameFileOperation(String remotePath, String newName) {
private void saveLocalFile() {
mFile.setFileName(mNewName);
-
+
// try to rename the local copy of the file
if (mFile.isDown()) {
String oldPath = mFile.getStoragePath();
String newPath = parentStoragePath + mNewName;
mFile.setStoragePath(newPath);
- // notify MediaScanner about removed file - TODO really works?
- getStorageManager().triggerMediaScan(oldPath);
+ // notify MediaScanner about removed file
+ getStorageManager().deleteFileInMediaScan(oldPath);
// notify to scan about new file
getStorageManager().triggerMediaScan(newPath);
}
*/
private boolean isValidNewName() throws IOException {
// check tricky names
- if (mNewName == null || mNewName.length() <= 0 || mNewName.contains(File.separator) || mNewName.contains("%")) {
+ if (mNewName == null || mNewName.length() <= 0 || mNewName.contains(File.separator)) {
return false;
}
// create a test file