Commit 3605cdb4 authored by yann300's avatar yann300

init localhost provider with read only mode

parent e17a8d11
...@@ -11,6 +11,7 @@ module.exports = class SharedFolder { ...@@ -11,6 +11,7 @@ module.exports = class SharedFolder {
this.error = { 'EEXIST': 'File already exists' } this.error = { 'EEXIST': 'File already exists' }
this._isReady = false this._isReady = false
this._readOnlyFiles = {} this._readOnlyFiles = {}
this._readOnlyMode = false
this.filesContent = {} this.filesContent = {}
this.files = {} this.files = {}
...@@ -58,8 +59,12 @@ module.exports = class SharedFolder { ...@@ -58,8 +59,12 @@ module.exports = class SharedFolder {
init (cb) { init (cb) {
this._remixd.ensureSocket((error) => { this._remixd.ensureSocket((error) => {
if (error) return cb(error)
this._isReady = !error this._isReady = !error
cb(error) this._remixd.call('sharedfolder', 'folderIsReadOnly', {}, (error, result) => {
this._readOnlyMode = result
cb(error)
})
}) })
} }
...@@ -110,7 +115,7 @@ module.exports = class SharedFolder { ...@@ -110,7 +115,7 @@ module.exports = class SharedFolder {
} }
isReadOnly (path) { isReadOnly (path) {
return this._readOnlyFiles[path] === 1 return this._readOnlyMode || this._readOnlyFiles[path] === 1
} }
remove (path) { remove (path) {
......
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