From 5625ef956d1a0e75891b5fc30b68c00ff5250b15 Mon Sep 17 00:00:00 2001 From: Raj <44002319+rajmusuku@users.noreply.github.com> Date: Wed, 27 Feb 2019 13:29:01 -0800 Subject: [PATCH] mkdir under notebook extension folder (#4214) --- .../src/jupyter/jupyterServerInstallation.ts | 2 -- extensions/notebook/src/jupyter/serverInstance.ts | 13 ++++++------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/extensions/notebook/src/jupyter/jupyterServerInstallation.ts b/extensions/notebook/src/jupyter/jupyterServerInstallation.ts index f394b958af..aee0d506f2 100644 --- a/extensions/notebook/src/jupyter/jupyterServerInstallation.ts +++ b/extensions/notebook/src/jupyter/jupyterServerInstallation.ts @@ -41,7 +41,6 @@ export default class JupyterServerInstallation { public extensionPath: string; public pythonBinPath: string; public outputChannel: OutputChannel; - public configRoot: string; public pythonEnvVarPath: string; public execOptions: ExecOptions; @@ -61,7 +60,6 @@ export default class JupyterServerInstallation { this.outputChannel = outputChannel; this.apiWrapper = apiWrapper; this._pythonInstallationPath = pythonInstallationPath || JupyterServerInstallation.getPythonInstallPath(this.apiWrapper); - this.configRoot = path.join(this.extensionPath, constants.jupyterConfigRootFolder); this._forceInstall = !!forceInstall; this.configurePackagePaths(); diff --git a/extensions/notebook/src/jupyter/serverInstance.ts b/extensions/notebook/src/jupyter/serverInstance.ts index d81fdfb8ae..ec9b0db645 100644 --- a/extensions/notebook/src/jupyter/serverInstance.ts +++ b/extensions/notebook/src/jupyter/serverInstance.ts @@ -178,7 +178,7 @@ export class PerNotebookServerInstance implements IServerInstance { } private async createInstanceFolders(): Promise { - 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 { 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.