mirror of
https://github.com/atom/atom.git
synced 2026-02-15 00:55:14 -05:00
Check if path exists before moving
fs.move() no longer throws an exception if the target exists so check for it explicitly when the dialog is confirmed.
This commit is contained in:
@@ -220,6 +220,14 @@ class TreeView extends ScrollView
|
||||
iconClass: 'move'
|
||||
onConfirm: (newPath) =>
|
||||
newPath = project.resolve(newPath)
|
||||
if oldPath is newPath
|
||||
dialog.close()
|
||||
return
|
||||
|
||||
if fs.exists(newPath)
|
||||
dialog.showError("Error: #{newPath} already exists. Try a different path.")
|
||||
return
|
||||
|
||||
directoryPath = fs.directory(newPath)
|
||||
try
|
||||
fs.makeTree(directoryPath) unless fs.exists(directoryPath)
|
||||
|
||||
Reference in New Issue
Block a user