mkdir under notebook extension folder (#4214)

This commit is contained in:
Raj
2019-02-27 13:29:01 -08:00
committed by GitHub
parent 969733ab77
commit 5625ef956d
2 changed files with 6 additions and 9 deletions

View File

@@ -178,7 +178,7 @@ export class PerNotebookServerInstance implements IServerInstance {
}
private async createInstanceFolders(): Promise<void> {
this.baseDir = path.join(this.options.install.configRoot, 'instances', `${this.utils.generateUuid()}`);
this.baseDir = path.join(this.getSystemJupyterHomeDir(), 'instances', `${this.utils.generateUuid()}`);
this.instanceConfigRoot = path.join(this.baseDir, 'config');
this.instanceDataRoot = path.join(this.baseDir, 'data');
await this.utils.mkDir(this.baseDir, this.options.install.outputChannel);
@@ -202,26 +202,25 @@ export class PerNotebookServerInstance implements IServerInstance {
private async copyKernelsToSystemJupyterDirs(): Promise<void> {
let kernelsExtensionSource = path.join(this.options.install.extensionPath, 'kernels');
this._systemJupyterDir = this.getSystemJupyterKernelDir();
this._systemJupyterDir = path.join(this.getSystemJupyterHomeDir(), 'kernels');
if (!this.utils.existsSync(this._systemJupyterDir)) {
await this.utils.mkDir(this._systemJupyterDir, this.options.install.outputChannel);
}
await this.utils.copy(kernelsExtensionSource, this._systemJupyterDir);
}
private getSystemJupyterKernelDir(): string {
private getSystemJupyterHomeDir(): string {
switch (process.platform) {
case 'win32':
let appDataWindows = process.env['APPDATA'];
return appDataWindows + '\\jupyter\\kernels';
return appDataWindows + '\\jupyter';
case 'darwin':
return path.resolve(os.homedir(), 'Library/Jupyter/kernels');
return path.resolve(os.homedir(), 'Library/Jupyter');
default:
return path.resolve(os.homedir(), '.local/share/jupyter/kernels');
return path.resolve(os.homedir(), '.local/share/jupyter');
}
}
/**
* Starts a Jupyter instance using the provided a start command. Server is determined to have
* started when the log message with URL to connect to is emitted.