Commit 7bf15f39 authored by yann300's avatar yann300

fix renaming/removal

parent 3b611d07
......@@ -281,6 +281,7 @@ var run = function () {
if (!files.rename(originalName, newName)) {
alert('Error while renaming file')
} else {
currentFile = null
switchToFile(newName)
editor.discard(originalName)
}
......@@ -301,6 +302,7 @@ var run = function () {
if (!files.remove(name)) {
alert('Error while removing file')
} else {
currentFile = null
switchToNextFile()
editor.discard(name)
}
......@@ -666,23 +668,28 @@ var run = function () {
function runCompiler () {
var files = {}
if (currentFile) {
var target = currentFile
files[target] = editor.get(currentFile)
compiler.compile(files, target)
}
}
function editorSyncFile () {
if (currentFile) {
var input = editor.get(currentFile)
files.set(currentFile, input)
}
}
var previousInput = ''
var compileTimeout = null
var saveTimeout = null
function editorOnChange () {
if (!currentFile) {
return
}
var input = editor.get(currentFile)
// if there's no change, don't do anything
......
......@@ -58,7 +58,7 @@ function Files (storage) {
}
this.isReadOnly = function (path) {
return !!readonly[path]
return readonly[path] !== undefined
}
this.remove = function (path) {
......
......@@ -2,7 +2,7 @@
function Storage () {
this.exists = function (name) {
return !!this.get(name)
return this.get(name) !== null
}
this.get = function (name) {
......
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