diff --git a/lib/client/dom.js b/lib/client/dom.js index 7faeb518..41405f7a 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -449,20 +449,24 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; function promptNew(typeName, type) { var RESTful = DOM.RESTful, - lName = Cmd.getCurrentName(), - lDir = Cmd.getCurrentDirPath(), - lMsg = 'New ' + typeName || 'File', - lType = Util.type.string(type) ? type : ''; + path = '', + name = Cmd.getCurrentName(), + dir = Cmd.getCurrentDirPath(), + msg = 'New ' + typeName || 'File'; - if (lName === '..') - lName = ''; + if (name === '..') + name = ''; - lName = Dialog.prompt(lMsg, lName); + name = Dialog.prompt(msg, name); + path = dir + name; - if (lName) - RESTful.write(lDir + lName + lType, null, function() { + if (type) + path += type; + + if (name) + RESTful.write(path, null, function() { CloudCmd.refresh(null, null, function() { - var current = DOM.getCurrentFileByName(lName); + var current = DOM.getCurrentFileByName(name); DOM.setCurrentFile(current); });