Skip to content

Commit

Permalink
Fix reading JUPYTER_RUNTIME_DIR and XDG_RUNTIME_DIR (#16451)
Browse files Browse the repository at this point in the history
Signed-off-by: Mathew Wicks <[email protected]>
  • Loading branch information
thesuperzapper authored Feb 18, 2025
1 parent 9f67a49 commit 245979f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/kernels/raw/finder/jupyterPaths.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,18 @@ export class JupyterPaths {
private async getRuntimeDirImpl(): Promise<Uri | undefined> {
let runtimeDir: Uri | undefined;
const userHomeDir = this.platformService.homeDir;
if (userHomeDir) {
if (process.env['JUPYTER_RUNTIME_DIR']) {
runtimeDir = Uri.file(path.normalize(process.env['JUPYTER_RUNTIME_DIR']));
} else if (userHomeDir) {
if (this.platformService.isWindows) {
// On windows the path is not correct if we combine those variables.
// It won't point to a path that you can actually read from.
runtimeDir = await tryGetRealPath(uriPath.joinPath(userHomeDir, winJupyterRuntimePath));
} else if (this.platformService.isMac) {
runtimeDir = uriPath.joinPath(userHomeDir, macJupyterRuntimePath);
} else {
runtimeDir = process.env['$XDG_RUNTIME_DIR']
? Uri.file(path.join(process.env['$XDG_RUNTIME_DIR'], 'jupyter', 'runtime'))
runtimeDir = process.env['XDG_RUNTIME_DIR']
? Uri.file(path.join(process.env['XDG_RUNTIME_DIR'], 'jupyter', 'runtime'))
: uriPath.joinPath(userHomeDir, '.local', 'share', 'jupyter', 'runtime');
}
}
Expand Down

0 comments on commit 245979f

Please sign in to comment.