()
| 40 | } |
| 41 | |
| 42 | async function getDesktopDataRoot(): Promise<string> { |
| 43 | const platform = getPlatformService(); |
| 44 | const defaultRoot = await getDefaultDataRoot(); |
| 45 | if (!platform.isDesktop) { |
| 46 | return defaultRoot; |
| 47 | } |
| 48 | |
| 49 | try { |
| 50 | const configPath = await getDesktopDataRootConfigPath(); |
| 51 | if (!(await platform.exists(configPath))) { |
| 52 | return defaultRoot; |
| 53 | } |
| 54 | |
| 55 | const raw = await platform.readTextFile(configPath); |
| 56 | const parsed = JSON.parse(raw) as { dataRoot?: string }; |
| 57 | const configuredRoot = normalizeDir(parsed.dataRoot || ""); |
| 58 | return configuredRoot || defaultRoot; |
| 59 | } catch { |
| 60 | return defaultRoot; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | export async function getActiveDataRoot(): Promise<string> { |
| 65 | return getDesktopDataRoot(); |
no test coverage detected