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

@@ -41,7 +41,6 @@ export default class JupyterServerInstallation {
public extensionPath: string; public extensionPath: string;
public pythonBinPath: string; public pythonBinPath: string;
public outputChannel: OutputChannel; public outputChannel: OutputChannel;
public configRoot: string;
public pythonEnvVarPath: string; public pythonEnvVarPath: string;
public execOptions: ExecOptions; public execOptions: ExecOptions;
@@ -61,7 +60,6 @@ export default class JupyterServerInstallation {
this.outputChannel = outputChannel; this.outputChannel = outputChannel;
this.apiWrapper = apiWrapper; this.apiWrapper = apiWrapper;
this._pythonInstallationPath = pythonInstallationPath || JupyterServerInstallation.getPythonInstallPath(this.apiWrapper); this._pythonInstallationPath = pythonInstallationPath || JupyterServerInstallation.getPythonInstallPath(this.apiWrapper);
this.configRoot = path.join(this.extensionPath, constants.jupyterConfigRootFolder);
this._forceInstall = !!forceInstall; this._forceInstall = !!forceInstall;
this.configurePackagePaths(); this.configurePackagePaths();

View File

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