mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 23:48:05 +03: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:
parent
28f89672d0
commit
7c41907a7d
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user