|
|
@ -59,12 +59,10 @@ module.exports = class RemixDProvider { |
|
|
|
cb() |
|
|
|
cb() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async init (cb) { |
|
|
|
init (cb) { |
|
|
|
await this._appManager.call('remixd', 'sharedFolder', { currentSharedFolder }) |
|
|
|
|
|
|
|
this._appManager.call('remixd', 'folderIsReadOnly', {}).then((result) => { |
|
|
|
this._appManager.call('remixd', 'folderIsReadOnly', {}).then((result) => { |
|
|
|
this._isReady = true |
|
|
|
this._isReady = true |
|
|
|
this._readOnlyMode = result |
|
|
|
this._readOnlyMode = result |
|
|
|
console.log('this._readOnlyMode: ', this._readOnlyMode) |
|
|
|
|
|
|
|
cb && cb() |
|
|
|
cb && cb() |
|
|
|
}).catch((error) => { |
|
|
|
}).catch((error) => { |
|
|
|
cb && cb(error) |
|
|
|
cb && cb(error) |
|
|
@ -81,13 +79,13 @@ module.exports = class RemixDProvider { |
|
|
|
//
|
|
|
|
//
|
|
|
|
// this.remixd.exists(path, (error, isValid) => {})
|
|
|
|
// this.remixd.exists(path, (error, isValid) => {})
|
|
|
|
|
|
|
|
|
|
|
|
async exists (path, cb) { |
|
|
|
exists (path, cb) { |
|
|
|
const unprefixedpath = this.removePrefix(path) |
|
|
|
const unprefixedpath = this.removePrefix(path) |
|
|
|
|
|
|
|
|
|
|
|
this._appManager.call('remixd', 'exists', {path: unprefixedpath}).then((result) => { |
|
|
|
return this._appManager.call('remixd', 'exists', { path: unprefixedpath }).then((result) => { |
|
|
|
return cb && cb(null, result) |
|
|
|
return cb(null, result) |
|
|
|
}).catch((error) => { |
|
|
|
}).catch((error) => { |
|
|
|
return cb && cb(error) |
|
|
|
return cb(error) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -101,16 +99,14 @@ module.exports = class RemixDProvider { |
|
|
|
|
|
|
|
|
|
|
|
get (path, cb) { |
|
|
|
get (path, cb) { |
|
|
|
var unprefixedpath = this.removePrefix(path) |
|
|
|
var unprefixedpath = this.removePrefix(path) |
|
|
|
this._appManager.call('remixd', 'get', {path: unprefixedpath}, (error, file) => { |
|
|
|
this._appManager.call('remixd', 'get', { path: unprefixedpath }).then((file) => { |
|
|
|
if (!error) { |
|
|
|
this.filesContent[path] = file.content |
|
|
|
this.filesContent[path] = file.content |
|
|
|
if (file.readonly) { this._readOnlyFiles[path] = 1 } |
|
|
|
if (file.readonly) { this._readOnlyFiles[path] = 1 } |
|
|
|
cb(error, file.content) |
|
|
|
cb(error, file.content) |
|
|
|
}).catch((error) => { |
|
|
|
} else { |
|
|
|
// display the last known content.
|
|
|
|
// display the last known content.
|
|
|
|
// TODO should perhaps better warn the user that the file is not synced.
|
|
|
|
// TODO should perhaps better warn the user that the file is not synced.
|
|
|
|
cb(null, this.filesContent[path]) |
|
|
|
cb(null, this.filesContent[path]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -190,9 +186,8 @@ module.exports = class RemixDProvider { |
|
|
|
|
|
|
|
|
|
|
|
async isFile (path) { |
|
|
|
async isFile (path) { |
|
|
|
const unprefixedpath = this.removePrefix(path) |
|
|
|
const unprefixedpath = this.removePrefix(path) |
|
|
|
const callId = await this._appManager.call('remixd', 'isFile', {path: unprefixedpath}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return await this._remixd.receiveResponse(callId) |
|
|
|
return await this._appManager.call('remixd', 'isFile', { path: unprefixedpath }) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -221,7 +216,6 @@ function remixapi (appManager, self) { |
|
|
|
path = '' + (path || '') |
|
|
|
path = '' + (path || '') |
|
|
|
path = pathtool.join('./', path) |
|
|
|
path = pathtool.join('./', path) |
|
|
|
appManager.call('remixd', 'resolveDirectory', { path }).then((filesList) => { |
|
|
|
appManager.call('remixd', 'resolveDirectory', { path }).then((filesList) => { |
|
|
|
console.log('filesList: ', filesList) |
|
|
|
|
|
|
|
callback(null, filesList) |
|
|
|
callback(null, filesList) |
|
|
|
}).catch((error) => { |
|
|
|
}).catch((error) => { |
|
|
|
callback(error) |
|
|
|
callback(error) |
|
|
|