init localhost provider with read only mode

pull/3094/head
yann300 6 years ago
parent 0d2fd2c346
commit 824006d413
  1. 7
      src/app/files/shared-folder.js

@ -11,6 +11,7 @@ module.exports = class SharedFolder {
this.error = { 'EEXIST': 'File already exists' }
this._isReady = false
this._readOnlyFiles = {}
this._readOnlyMode = false
this.filesContent = {}
this.files = {}
@ -58,9 +59,13 @@ module.exports = class SharedFolder {
init (cb) {
this._remixd.ensureSocket((error) => {
if (error) return cb(error)
this._isReady = !error
this._remixd.call('sharedfolder', 'folderIsReadOnly', {}, (error, result) => {
this._readOnlyMode = result
cb(error)
})
})
}
// @TODO: refactor all `this._remixd.call(....)` uses into `this.remixd[api](...)`
@ -110,7 +115,7 @@ module.exports = class SharedFolder {
}
isReadOnly (path) {
return this._readOnlyFiles[path] === 1
return this._readOnlyMode || this._readOnlyFiles[path] === 1
}
remove (path) {

Loading…
Cancel
Save