Fixed fail new file save :w

This commit is contained in:
henteko 2016-08-09 00:58:29 +09:00
parent a59a6f9364
commit 93a56c75ce
2 changed files with 2 additions and 6 deletions

View file

@ -222,11 +222,7 @@ class Ex
if not saved and fullPath? if not saved and fullPath?
if not force and fs.existsSync(fullPath) if not force and fs.existsSync(fullPath)
throw new CommandError("File exists (add ! to override)") throw new CommandError("File exists (add ! to override)")
if saveas trySave(-> editor.saveAs(fullPath, editor)).then(deferred.resolve)
editor = atom.workspace.getActiveTextEditor()
trySave(-> editor.saveAs(fullPath, editor)).then(deferred.resolve)
else
trySave(-> saveAs(fullPath, editor)).then(deferred.resolve)
deferred.promise deferred.promise

View file

@ -117,7 +117,7 @@ describe "the commands", ->
newPath = path.resolve(dir, fs.normalize(newPath)) newPath = path.resolve(dir, fs.normalize(newPath))
expect(fs.existsSync(newPath)).toBe(true) expect(fs.existsSync(newPath)).toBe(true)
expect(fs.readFileSync(newPath, 'utf-8')).toEqual('abc') expect(fs.readFileSync(newPath, 'utf-8')).toEqual('abc')
expect(editor.isModified()).toBe(true) expect(editor.isModified()).toBe(false)
fs.removeSync(newPath) fs.removeSync(newPath)
it "saves to the path", -> it "saves to the path", ->