commit
042bce7644
File diff suppressed because it is too large
Load Diff
@ -1,39 +0,0 @@ |
||||
'use strict' |
||||
var ReadOnlyExplorer = require('./basicReadOnlyExplorer') |
||||
var toolTip = require('../ui/tooltip') |
||||
|
||||
class NotPersistedExplorer extends ReadOnlyExplorer { |
||||
constructor (type) { |
||||
super(type) |
||||
this.readonly = false |
||||
} |
||||
|
||||
remove (path) { |
||||
var unprefixedPath = this.removePrefix(path) |
||||
var folderPath = path.substring(0, path.lastIndexOf('/')) |
||||
if (this.paths[folderPath]) { |
||||
delete this.paths[folderPath][unprefixedPath] |
||||
delete this.files[path] |
||||
} |
||||
this.event.trigger('fileRemoved', [this.type + '/' + unprefixedPath]) |
||||
return true |
||||
} |
||||
|
||||
rename (oldPath, newPath, isFolder) { |
||||
if (isFolder) { return toolTip('folder renaming is not handled by this explorer') } |
||||
var unprefixedoldPath = this.removePrefix(oldPath) |
||||
var unprefixednewPath = this.removePrefix(newPath) |
||||
this.get(oldPath, (error, content) => { |
||||
if (error) return console.log(error) |
||||
this.remove(oldPath) |
||||
this.set(newPath, content) |
||||
this.event.trigger('fileRenamed', [this.type + '/' + unprefixedoldPath, this.type + '/' + unprefixednewPath, isFolder]) |
||||
}) |
||||
} |
||||
|
||||
isReadOnly (path) { |
||||
return false |
||||
} |
||||
} |
||||
|
||||
module.exports = NotPersistedExplorer |
@ -0,0 +1,29 @@ |
||||
'use strict' |
||||
|
||||
class FileProvider { |
||||
|
||||
exists (path, cb) { throw new Error(this.name + ' function is not implemented for ' + this.constructor.name + ' class') } |
||||
|
||||
init (cb) { throw new Error(this.name + ' function is not implemented for ' + this.constructor.name + ' class') } |
||||
|
||||
get (path, cb) { throw new Error(this.name + ' function is not implemented for ' + this.constructor.name + ' class') } |
||||
|
||||
set (path, content, cb) { throw new Error(this.name + ' function is not implemented for ' + this.constructor.name + ' class') } |
||||
|
||||
addReadOnly (path, content) { throw new Error(this.name + ' function is not implemented for ' + this.constructor.name + ' class') } |
||||
|
||||
isReadOnly (path) { throw new Error(this.name + ' function is not implemented for ' + this.constructor.name + ' class') } |
||||
|
||||
remove (path) { throw new Error(this.name + ' function is not implemented for ' + this.constructor.name + ' class') } |
||||
|
||||
rename (oldPath, newPath, isFolder) { throw new Error(this.name + ' function is not implemented for ' + this.constructor.name + ' class') } |
||||
|
||||
resolveDirectory (path, callback) { throw new Error(this.name + ' function is not implemented for ' + this.constructor.name + ' class') } |
||||
|
||||
removePrefix (path) { throw new Error(this.name + ' function is not implemented for ' + this.constructor.name + ' class') } |
||||
|
||||
updateRefs (path, type) { throw new Error(this.name + ' function is not implemented for ' + this.constructor.name + ' class') } |
||||
|
||||
} |
||||
|
||||
module.exports = FileProvider |
@ -0,0 +1,18 @@ |
||||
'use strict' |
||||
let BasicFileProvider = require('./basicFileProvider') |
||||
|
||||
class ReadonlyProvider extends BasicFileProvider { |
||||
|
||||
remove (path) { |
||||
return false |
||||
} |
||||
|
||||
rename (oldPath, newPath, isFolder) { |
||||
return false |
||||
} |
||||
|
||||
isReadOnly (path) { |
||||
return true |
||||
} |
||||
} |
||||
module.exports = ReadonlyProvider |
Loading…
Reference in new issue