if WAVETERM_HOME is set, use that in emain (#859)

This commit is contained in:
Mike Sawka 2024-09-25 16:16:07 -07:00 committed by GitHub
parent 718ebb8170
commit a4bc0fa93b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,8 @@ import path from "path";
import { WaveDevVarName, WaveDevViteVarName } from "../frontend/util/isdev"; import { WaveDevVarName, WaveDevViteVarName } from "../frontend/util/isdev";
import * as keyutil from "../frontend/util/keyutil"; import * as keyutil from "../frontend/util/keyutil";
const WaveHomeVarName = "WAVETERM_HOME";
const isDev = !app.isPackaged; const isDev = !app.isPackaged;
const isDevVite = isDev && process.env.ELECTRON_RENDERER_URL; const isDevVite = isDev && process.env.ELECTRON_RENDERER_URL;
if (isDev) { if (isDev) {
@ -37,6 +39,10 @@ ipcMain.on("get-host-name", (event) => {
// must match golang // must match golang
function getWaveHomeDir() { function getWaveHomeDir() {
const override = process.env[WaveHomeVarName];
if (override) {
return override;
}
return path.join(os.homedir(), isDev ? ".waveterm-dev" : ".waveterm"); return path.join(os.homedir(), isDev ? ".waveterm-dev" : ".waveterm");
} }