MCPcopy Create free account
hub / github.com/cortexkit/magic-context / resolve

Method resolve

packages/dashboard/src-tauri/src/commands.rs:605–623  ·  view source on GitHub ↗

Derive the env from already-resolved roots. Falls back to home-derived Windows AppData roots when those env vars are unset, so a Desktop user is never misreported as having no OpenCode install just because %APPDATA% / %LOCALAPPDATA% are absent in this process environment. Kept in lockstep with the CLI's opencode-detect.ts fallbacks.

(
        home: Option<PathBuf>,
        appdata: Option<PathBuf>,
        localappdata: Option<PathBuf>,
        xdg_config_home: Option<PathBuf>,
        xdg_data_home: Option<PathBuf>,
    )

Source from the content-addressed store, hash-verified

603 /// %LOCALAPPDATA% are absent in this process environment. Kept in lockstep
604 /// with the CLI's opencode-detect.ts fallbacks.
605 fn resolve(
606 home: Option<PathBuf>,
607 appdata: Option<PathBuf>,
608 localappdata: Option<PathBuf>,
609 xdg_config_home: Option<PathBuf>,
610 xdg_data_home: Option<PathBuf>,
611 ) -> Self {
612 let appdata = appdata.or_else(|| home.as_ref().map(|h| h.join("AppData").join("Roaming")));
613 let localappdata =
614 localappdata.or_else(|| home.as_ref().map(|h| h.join("AppData").join("Local")));
615 Self {
616 home,
617 appdata,
618 localappdata,
619 xdg_config_home,
620 xdg_data_home,
621 mac_system_applications: PathBuf::from("/Applications"),
622 }
623 }
624}
625
626fn env_path(name: &str) -> Option<PathBuf> {

Callers 15

serverFunction · 0.80
sendConflictWarningFunction · 0.80
cleanupConflictWarningsFunction · 0.80
sendSchemaFenceWarningFunction · 0.80
sendStartupAnnouncementFunction · 0.80
handleSocketMessageFunction · 0.80
runWithSessionLockFunction · 0.80
expectedDirIdentityFunction · 0.80
unifiedSearchFunction · 0.80
readProjectDocsCanonicalFunction · 0.80

Calls

no outgoing calls

Tested by 3

expectedDirIdentityFunction · 0.64
createCtxFunction · 0.64
flushMicrotasksFunction · 0.64