diff --git a/src/main/orcad/orcad-entry.ts b/src/main/orcad/orcad-entry.ts index 9120e050cc6..f27d0bcb35b 100644 --- a/src/main/orcad/orcad-entry.ts +++ b/src/main/orcad/orcad-entry.ts @@ -291,12 +291,8 @@ async function startOrcadRuntime( }) // Why before any launch: a desktop that owns this host's accounts pushed them on an earlier run. - const { readOrcadHostAccountLaunchEnv, writeOrcadHostAccountLaunchEnv } = - await import('./orcad-host-account-launch-env-store') - runtime.restoreHostAccountLaunchEnv( - readOrcadHostAccountLaunchEnv(runtimeUserDataPath), - (launchEnv) => writeOrcadHostAccountLaunchEnv(runtimeUserDataPath, launchEnv) - ) + const { restoreOrcadHostAccountLaunchEnv } = await import('./orcad-host-account-launch-env-store') + restoreOrcadHostAccountLaunchEnv(runtime, runtimeUserDataPath) const { installOrcadSessionSearchService } = await import('./orcad-session-search') sessionSearch = await installOrcadSessionSearchService({ diff --git a/src/main/orcad/orcad-host-account-launch-env-store.ts b/src/main/orcad/orcad-host-account-launch-env-store.ts index 2dab54701fb..ad37bdfd964 100644 --- a/src/main/orcad/orcad-host-account-launch-env-store.ts +++ b/src/main/orcad/orcad-host-account-launch-env-store.ts @@ -9,6 +9,7 @@ import { HostAccountLaunchEnvParams, type HostAccountLaunchEnv } from '../../shared/host-account-launch-env' +import type { OrcaRuntimeService } from '../runtime/orca-runtime' const FILE_NAME = 'host-account-launch-env.json' @@ -41,3 +42,12 @@ export function writeOrcadHostAccountLaunchEnv( throw error } } + +export function restoreOrcadHostAccountLaunchEnv( + runtime: Pick, + userDataPath: string +): void { + runtime.restoreHostAccountLaunchEnv(readOrcadHostAccountLaunchEnv(userDataPath), (launchEnv) => + writeOrcadHostAccountLaunchEnv(userDataPath, launchEnv) + ) +}