fix(dom) renameCurrent: when there is file with same name - two same names is shown on a panel

This commit is contained in:
coderaiser 2015-03-11 09:44:42 -04:00
parent d82ea49e94
commit d31345203f

View file

@ -1531,7 +1531,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
* @currentFile
*/
this.renameCurrent = function(current) {
var from, to, dirPath, files,
var from, to, dirPath, files, isExist,
RESTful = DOM.RESTful;
if (!Cmd.isCurrentFile(current))
@ -1543,6 +1543,8 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
Dialog.alert('No files selected!');
} else {
to = Dialog.prompt('Rename', from) || from;
isExist = !!DOM.getCurrentByName(to);
dirPath = Cmd.getCurrentDirPath();
if (from !== to) {
@ -1558,6 +1560,9 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
DOM.setCurrentName(to, current);
Cmd.updateCurrentInfo();
Storage.remove(path);
if (isExist)
CloudCmd.refresh();
});
}
}