mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
fix(dom) renameCurrent: rm dir listing from Storage
This commit is contained in:
parent
dd46da4005
commit
e63fa22c75
1 changed files with 19 additions and 13 deletions
|
|
@ -1604,23 +1604,29 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
*
|
||||
* @pCurrent
|
||||
*/
|
||||
this.renameCurrent = function(pCurrentFile) {
|
||||
if (!Cmd.isCurrentFile(pCurrentFile))
|
||||
pCurrentFile = null;
|
||||
this.renameCurrent = function(current) {
|
||||
var from, to, dirPath, cmp, files;
|
||||
|
||||
var lCurrent = pCurrentFile || Cmd.getCurrentFile(),
|
||||
lFrom = Cmd.getCurrentName(lCurrent),
|
||||
lTo = Dialog.prompt('Rename', lFrom) || lFrom,
|
||||
lDirPath = Cmd.getCurrentDirPath();
|
||||
if (!Cmd.isCurrentFile(current))
|
||||
current = Cmd.getCurrentFile();
|
||||
|
||||
if (!Util.strCmp(lFrom, lTo)) {
|
||||
var lFiles = {
|
||||
from : lDirPath + lFrom,
|
||||
to : lDirPath + lTo
|
||||
from = Cmd.getCurrentName(current),
|
||||
to = Dialog.prompt('Rename', from) || from,
|
||||
dirPath = Cmd.getCurrentDirPath();
|
||||
cmp = Util.strCmp(from, to);
|
||||
|
||||
if (!cmp) {
|
||||
files = {
|
||||
from : dirPath + from,
|
||||
to : dirPath + to
|
||||
};
|
||||
|
||||
RESTful.mv(lFiles, function() {
|
||||
DOM.setCurrentName(lTo, lCurrent);
|
||||
RESTful.mv(files, function() {
|
||||
var Storage = DOM.Storage,
|
||||
path = CloudFunc.rmLastSlash(dirPath);
|
||||
|
||||
DOM.setCurrentName(to, current);
|
||||
Storage.remove(path);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue