MCPcopy
hub / github.com/codedogQBY/ReadAny / getDesktopDataRoot

Function getDesktopDataRoot

packages/core/src/db/db-core.ts:42–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40}
41
42async 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
64export async function getActiveDataRoot(): Promise<string> {
65 return getDesktopDataRoot();

Callers 2

getActiveDataRootFunction · 0.85
getDatabaseFilePathFunction · 0.85

Calls 6

getPlatformServiceFunction · 0.90
getDefaultDataRootFunction · 0.85
normalizeDirFunction · 0.70
existsMethod · 0.65
readTextFileMethod · 0.65

Tested by

no test coverage detected