Skip to content

Commit

Permalink
Include default.xml if --datadir is not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita488 committed Oct 25, 2024
1 parent 3d65291 commit ef9352c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,23 @@ export class GTA3ScriptController {
const addConfigs = new Array<string>();

try {
let hasDataDir = false;

for await (const line of rl) {
const arg = line.split("=");

if (arg.length == 2 && arg[0].trim() === "--add-config") {
addConfigs.push(arg[1].trim());
if (arg.length == 2) {
const key = arg[0].trim();

if (key === "--add-config") {
addConfigs.push(arg[1].trim());
} else if (key === "--datadir") {
hasDataDir = true;
}
}
}

if (!hasDataDir) addConfigs.push("default.xml");
} catch (err) {
return Promise.resolve([]);
}
Expand Down

0 comments on commit ef9352c

Please sign in to comment.