Commit c07dbc4f authored by Alex Beregszaszi's avatar Alex Beregszaszi

Show alert if renaming/removing failed

parent 44091ec2
...@@ -272,9 +272,12 @@ var run = function () { ...@@ -272,9 +272,12 @@ 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)) {
switchToFile(newName) alert('Error while renaming file')
editor.discard(originalName) } else {
switchToFile(newName)
editor.discard(originalName)
}
} }
return false return false
...@@ -289,9 +292,12 @@ var run = function () { ...@@ -289,9 +292,12 @@ 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)) {
switchToNextFile() alert('Error while removing file')
editor.discard(name) } else {
switchToNextFile()
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