|
|
@ -34,7 +34,7 @@ class FSPluginClient extends PluginClient { |
|
|
|
watcher: chokidar.FSWatcher |
|
|
|
watcher: chokidar.FSWatcher |
|
|
|
constructor() { |
|
|
|
constructor() { |
|
|
|
super() |
|
|
|
super() |
|
|
|
this.methods = ['readdir', 'readFile', 'writeFile', 'mkdir', 'rmdir', 'unlink', 'rename', 'stat', 'exists', 'watch', 'closeWatch'] |
|
|
|
this.methods = ['readdir', 'readFile', 'writeFile', 'mkdir', 'rmdir', 'unlink', 'rename', 'stat', 'exists', 'watch', 'closeWatch', 'currentPath'] |
|
|
|
createClient(this, profile) |
|
|
|
createClient(this, profile) |
|
|
|
this.onload(() => { |
|
|
|
this.onload(() => { |
|
|
|
console.log('fsPluginClient onload') |
|
|
|
console.log('fsPluginClient onload') |
|
|
@ -78,6 +78,10 @@ class FSPluginClient extends PluginClient { |
|
|
|
return fs.access(path).then(() => true).catch(() => false) |
|
|
|
return fs.access(path).then(() => true).catch(() => false) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async currentPath(): Promise<string> { |
|
|
|
|
|
|
|
return process.cwd() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async watch(path: string): Promise<void> { |
|
|
|
async watch(path: string): Promise<void> { |
|
|
|
console.log('watch', path) |
|
|
|
console.log('watch', path) |
|
|
|
if(this.watcher) this.watcher.close() |
|
|
|
if(this.watcher) this.watcher.close() |
|
|
|