|
|
@ -30,7 +30,7 @@ class WorkspaceFileProvider extends FileProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
removePrefix (path) { |
|
|
|
removePrefix (path) { |
|
|
|
if (!this.workspace) this.createDefaultWorkspace() |
|
|
|
if (!this.workspace) this.createWorkspace() |
|
|
|
path = path.replace(/^\/|\/$/g, '') // remove first and last slash
|
|
|
|
path = path.replace(/^\/|\/$/g, '') // remove first and last slash
|
|
|
|
if (path.startsWith(this.workspacesPath + '/' + this.workspace)) return path |
|
|
|
if (path.startsWith(this.workspacesPath + '/' + this.workspace)) return path |
|
|
|
if (path.startsWith(this.workspace)) return this.workspacesPath + '/' + this.workspace |
|
|
|
if (path.startsWith(this.workspace)) return this.workspacesPath + '/' + this.workspace |
|
|
@ -51,7 +51,7 @@ class WorkspaceFileProvider extends FileProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
resolveDirectory (path, callback) { |
|
|
|
resolveDirectory (path, callback) { |
|
|
|
if (!this.workspace) this.createDefaultWorkspace() |
|
|
|
if (!this.workspace) this.createWorkspace() |
|
|
|
super.resolveDirectory(path, (error, files) => { |
|
|
|
super.resolveDirectory(path, (error, files) => { |
|
|
|
if (error) return callback(error) |
|
|
|
if (error) return callback(error) |
|
|
|
const unscoped = {} |
|
|
|
const unscoped = {} |
|
|
@ -76,13 +76,13 @@ class WorkspaceFileProvider extends FileProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_normalizePath (path) { |
|
|
|
_normalizePath (path) { |
|
|
|
if (!this.workspace) this.createDefaultWorkspace() |
|
|
|
if (!this.workspace) this.createWorkspace() |
|
|
|
return path.replace(this.workspacesPath + '/' + this.workspace + '/', '') |
|
|
|
return path.replace(this.workspacesPath + '/' + this.workspace + '/', '') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
createDefaultWorkspace () { |
|
|
|
createWorkspace (name) { |
|
|
|
this.workspace = 'generated_workspace' |
|
|
|
if (!name) name = 'default_workspace' |
|
|
|
this.event.trigger('create_workspace_default', [this.workspace]) |
|
|
|
this.event.trigger('create_workspace', [name]) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|