f851d8b8f2
Electron desktop application for Neverwinter Nights module development. Clone, edit, build, and run a complete Layonara NWNX server with only Docker required. - React 19 + Vite frontend with Monaco editor and NWScript LSP - Node.js + Express backend managing Docker sibling containers - Electron shell with Docker availability check and auto-setup - Builder image auto-builds on first use from bundled Dockerfile - Cross-platform: Windows (.exe), macOS (.dmg), Linux (.AppImage) - Gitea Actions CI for automated release builds
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import path from "path";
|
|
import os from "os";
|
|
import fs from "fs";
|
|
|
|
export function defaultWorkspacePath(): string {
|
|
return path.join(os.homedir(), "Layonara Forge");
|
|
}
|
|
|
|
export function detectNwnHome(): string | null {
|
|
const candidates: string[] = [];
|
|
|
|
if (process.platform === "win32") {
|
|
const docs = path.join(os.homedir(), "Documents", "Neverwinter Nights");
|
|
candidates.push(docs);
|
|
const steam = path.join(
|
|
"C:",
|
|
"Program Files (x86)",
|
|
"Steam",
|
|
"steamapps",
|
|
"common",
|
|
"Neverwinter Nights",
|
|
);
|
|
candidates.push(steam);
|
|
} else if (process.platform === "darwin") {
|
|
candidates.push(path.join(os.homedir(), "Documents", "Neverwinter Nights"));
|
|
candidates.push(
|
|
path.join(os.homedir(), "Library", "Application Support", "Neverwinter Nights"),
|
|
);
|
|
} else {
|
|
candidates.push(path.join(os.homedir(), ".local", "share", "Neverwinter Nights"));
|
|
candidates.push(
|
|
path.join(os.homedir(), ".steam", "steam", "steamapps", "common", "Neverwinter Nights"),
|
|
);
|
|
}
|
|
|
|
for (const candidate of candidates) {
|
|
try {
|
|
if (fs.statSync(candidate).isDirectory()) return candidate;
|
|
} catch {
|
|
continue;
|
|
}
|
|
}
|
|
return null;
|
|
}
|