Skip to content

Commit 5603b4e

Browse files
committed
set Snap home and userData directories
1 parent 35fb4f0 commit 5603b4e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/main/main.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,19 @@ import {
99
getBundledPythonPath,
1010
installBundledEnvironment,
1111
isDevMode,
12+
isSnap,
1213
jlabCLICommandIsSetup,
1314
setupJlabCommandWithUserRights,
1415
versionWithoutSuffix,
1516
waitForDuration,
1617
waitForFunction
1718
} from './utils';
19+
20+
if (isSnap()) {
21+
app.setPath('home', process.env.HOME);
22+
app.setPath('userData', `${process.env.HOME}/.config/${app.getName()}`);
23+
}
24+
1825
import { JupyterApplication } from './app';
1926
import { ICLIArguments } from './tokens';
2027
import { SessionConfig } from './config/sessionconfig';

src/main/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export function isDevMode(): boolean {
3030
return require.main.filename.indexOf('app.asar') === -1;
3131
}
3232

33+
export function isSnap(): boolean {
34+
return process.platform === 'linux' && process.env.SNAP !== undefined;
35+
}
36+
3337
export function getAppDir(): string {
3438
let appDir = app.getAppPath();
3539
if (!isDevMode()) {

0 commit comments

Comments
 (0)