MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / resolveMCDRServerRoot

Function resolveMCDRServerRoot

daemon/src/service/mcdr_service.ts:7–19  ·  view source on GitHub ↗
(type: string, instanceCwd: string)

Source from the content-addressed store, hash-verified

5export const TYPE_MINECRAFT_MCDR = "universal/mcdr";
6
7export function resolveMCDRServerRoot(type: string, instanceCwd: string): string | null {
8 if (type !== TYPE_MINECRAFT_MCDR) return null;
9 try {
10 const raw = fs.readFileSync(path.join(instanceCwd, "config.yml"), "utf-8");
11 const dir = yaml.parse(raw)?.working_directory;
12 if (typeof dir !== "string" || !dir.trim()) return null;
13 return path.isAbsolute(dir)
14 ? path.normalize(dir)
15 : path.normalize(path.join(instanceCwd, dir.trim()));
16 } catch {
17 return null;
18 }
19}

Callers 5

listModsMethod · 0.90
toggleModMethod · 0.90
deleteModMethod · 0.90
installModMethod · 0.90
getModConfigMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected