16 lines
360 B
TypeScript
16 lines
360 B
TypeScript
import path from "path";
|
|
import fs from "fs";
|
|
|
|
export function resolveRuntimeRoot(cwd: string = process.cwd()): string {
|
|
const explicitRoot = process.env.OVERLORD_ROOT?.trim();
|
|
if (explicitRoot) {
|
|
return path.resolve(explicitRoot);
|
|
}
|
|
|
|
if (fs.existsSync(path.join(cwd, "Overlord-Client"))) {
|
|
return cwd;
|
|
}
|
|
|
|
return path.resolve(cwd, "..");
|
|
}
|