Set a default initial directory, handle an existing settings file with no project directory (#3734)
* Fix the project directory setting assignment from file * Fix default project directory value initialization * Add a couple tests for loading the app without project directory settings * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) * A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest) * trigger CI * Object merging logic was bad, blew away other app settings if they existed * Update silly little export file size expectation numbers * Make rename timeout in test way shorter * Fix silly little test issues --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Kurt Hutten Irev-Dev <k.hutten@protonmail.ch>
This commit is contained in:
@ -14,6 +14,7 @@ import { Configuration } from 'wasm-lib/kcl/bindings/Configuration'
|
||||
import { mouseControlsToCameraSystem } from 'lib/cameraControls'
|
||||
import { appThemeToTheme } from 'lib/theme'
|
||||
import {
|
||||
getInitialDefaultDir,
|
||||
readAppSettingsFile,
|
||||
readProjectSettingsFile,
|
||||
writeAppSettingsFile,
|
||||
@ -176,6 +177,11 @@ export async function loadAndValidateSettings(
|
||||
if (err(appSettingsPayload)) return Promise.reject(appSettingsPayload)
|
||||
|
||||
const settings = createSettings()
|
||||
// Because getting the default directory is async, we need to set it after
|
||||
if (onDesktop) {
|
||||
settings.app.projectDirectory.default = await getInitialDefaultDir()
|
||||
}
|
||||
|
||||
setSettingsAtLevel(
|
||||
settings,
|
||||
'user',
|
||||
|
Reference in New Issue
Block a user