+ private void saveLocalFile() {
+ mFile.setFileName(mNewName);
+
+ // try to rename the local copy of the file
+ if (mFile.isDown()) {
+ 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))) {
+ 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
+ }
+
+ getStorageManager().saveFile(mFile);
+ }
+