Fix app settings location not changing betwen nightly and release (#6656)

App settings location is not changing betwen nightly and release
Fixes #6655
This commit is contained in:
Pierre Jacquier
2025-05-05 19:23:34 -04:00
committed by GitHub
parent 574d6dae7f
commit 8f72920764

View File

@ -25,6 +25,7 @@ import type { FileEntry, Project } from '@src/lib/project'
import { err } from '@src/lib/trap' import { err } from '@src/lib/trap'
import type { DeepPartial } from '@src/lib/types' import type { DeepPartial } from '@src/lib/types'
import { getInVariableCase } from '@src/lib/utils' import { getInVariableCase } from '@src/lib/utils'
import { IS_NIGHTLY } from '@src/routes/utils'
export async function renameProjectDirectory( export async function renameProjectDirectory(
projectPath: string, projectPath: string,
@ -450,14 +451,19 @@ export async function writeProjectSettingsFile(
return window.electron.writeFile(projectSettingsFilePath, tomlStr) return window.electron.writeFile(projectSettingsFilePath, tomlStr)
} }
// Since we want backwards compatibility with the old settings file, we need to // Important for saving settings.
// rename the folder for macos. // TODO: should be pulled from electron-builder.yml
const MACOS_APP_NAME = 'dev.zoo.modeling-app' const APP_ID = IS_NIGHTLY
? 'dev.zoo.modeling-app-nightly'
: 'dev.zoo.modeling-app'
const getAppFolderName = () => { const getAppFolderName = () => {
if (window.electron.os.isMac || window.electron.os.isWindows) { if (window.electron.os.isMac || window.electron.os.isWindows) {
return MACOS_APP_NAME return APP_ID
} }
// TODO: we need to make linux use the same convention this is weird
// This variable below gets the -nightly suffix on nighly too thru scripts/flip-files-to-nightly.sh
// But it should be consistent with the reserve domain app id we use on Windows and Linux
return window.electron.packageJson.name return window.electron.packageJson.name
} }