Skip to content

Commit 31e3018

Browse files
committed
Fix arg handling compatibility
1 parent 8c4d576 commit 31e3018

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ A server for querying placement objects in *The Legend of Zelda: Tears of the Ki
33

44
Run build.ts to generate a map database before starting the server for the first time.
55

6+
ts-node build.ts -d ../totk/Banc
7+
8+
This assumes the `totk/Banc` directory contains the YAML data object map files
9+
610
ts-node build.ts -r ../totk -e tools
711

812
This assumes the `totk` directory contains the unaltered romfs contents.

build.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,22 @@ import { Beco } from './beco';
77

88
let parseArgs = require('minimist');
99
let argv = parseArgs(process.argv);
10-
if (!argv.e || !argv.r) {
11-
console.log("Error: Must specify paths to directories with ");
10+
const validRomfsArgs = (argv.e && argv.r);
11+
const validFolderArgs = (argv.e && argv.b && argv.d);
12+
if (!validRomfsArgs && !validFolderArgs) {
13+
console.log("Error: Must specify paths to directories with -e and either -r or (-b and -d)");
14+
console.log(" -d Banc extracted YAML files");
15+
console.log(" -b field map area beco files");
1216
console.log(" -e Ecosystem json files");
1317
console.log(" -r Bare game romfs");
14-
console.log(" e.g. % ts-node build.ts -r path/to/romfs -e tools")
18+
console.log(" e.g. % ts-node build.ts -d path/to/Banc -b path/to/beco -e path/to/Ecosystem")
19+
console.log(" or: % ts-node build.ts -r path/to/romfs -e path/to/Ecosystem")
1520
process.exit(1);
1621
}
1722
const ecoPath = argv.e;
1823
const romfsPath = argv.r;
19-
const totkData = path.join(romfsPath, 'Banc');
20-
const becoPath = path.join(romfsPath, 'Ecosystem', 'FieldMapArea');
24+
const totkData = argv.d || path.join(romfsPath, 'Banc');
25+
const becoPath = argv.b || path.join(romfsPath, 'Ecosystem', 'FieldMapArea');
2126

2227
fs.rmSync('map.db.tmp', { force: true });
2328
const db = sqlite3('map.db.tmp');

0 commit comments

Comments
 (0)