Commit c07dbc4f authored by Alex Beregszaszi's avatar Alex Beregszaszi

Show alert if renaming/removing failed

parent 44091ec2
...@@ -272,10 +272,13 @@ var run = function () { ...@@ -272,10 +272,13 @@ var run = function () {
files.exists(newName) files.exists(newName)
? 'Are you sure you want to overwrite: ' + newName + ' with ' + originalName + '?' ? 'Are you sure you want to overwrite: ' + newName + ' with ' + originalName + '?'
: 'Are you sure you want to rename: ' + originalName + ' to ' + newName + '?')) { : 'Are you sure you want to rename: ' + originalName + ' to ' + newName + '?')) {
files.rename(originalName, newName) if (!files.rename(originalName, newName)) {
alert('Error while renaming file')
} else {
switchToFile(newName) switchToFile(newName)
editor.discard(originalName) editor.discard(originalName)
} }
}
return false return false
} }
...@@ -289,10 +292,13 @@ var run = function () { ...@@ -289,10 +292,13 @@ var run = function () {
var name = $(this).parent().find('.name').text() var name = $(this).parent().find('.name').text()
if (confirm('Are you sure you want to remove: ' + name + ' from local storage?')) { if (confirm('Are you sure you want to remove: ' + name + ' from local storage?')) {
files.remove(name) if (!files.remove(name)) {
alert('Error while removing file')
} else {
switchToNextFile() switchToNextFile()
editor.discard(name) editor.discard(name)
} }
}
return false return false
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment