Skip to content

Commit de94eb8

Browse files
Changed romfs path to look for dictionary instead of pack folder
1 parent 6934f24 commit de94eb8

1 file changed

Lines changed: 20 additions & 11 deletions

File tree

src/extension.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,30 +1619,39 @@ async function runFirstTimeSetup(context: vscode.ExtensionContext): Promise<void
16191619
});
16201620
if (folderUri && folderUri.length > 0) {
16211621
const fsPath = folderUri[0].fsPath;
1622-
const folderName = path.basename(fsPath).toLowerCase();
16231622

1624-
if (folderName === 'romfs') {
1623+
const zsdicPath = path.join(fsPath, 'Pack', 'ZsDic.pack.zs');
1624+
if (fs.existsSync(zsdicPath)) {
16251625
const config = vscode.workspace.getConfiguration('TKVSC');
16261626
await config.update('romfsPath', fsPath, vscode.ConfigurationTarget.Global);
16271627
void vscode.window.showInformationMessage(`TKVSC: RomFS path set to ${fsPath}`);
16281628
validRomfsSelected = true;
16291629
} else {
1630+
let foundNested = false;
16301631
try {
16311632
const entries = await vscode.workspace.fs.readDirectory(folderUri[0]);
1632-
const hasRomfs = entries.some(([name, type]) => type === vscode.FileType.Directory && name.toLowerCase() === 'romfs');
1633-
if (hasRomfs) {
1634-
const newPath = path.join(fsPath, 'romfs');
1635-
const config = vscode.workspace.getConfiguration('TKVSC');
1636-
await config.update('romfsPath', newPath, vscode.ConfigurationTarget.Global);
1637-
void vscode.window.showInformationMessage(`TKVSC: RomFS path set to ${newPath}`);
1638-
validRomfsSelected = true;
1639-
continue;
1633+
for (const [name, type] of entries) {
1634+
if (type === vscode.FileType.Directory) {
1635+
const nestedPath = path.join(fsPath, name);
1636+
if (fs.existsSync(path.join(nestedPath, 'Pack', 'ZsDic.pack.zs'))) {
1637+
const config = vscode.workspace.getConfiguration('TKVSC');
1638+
await config.update('romfsPath', nestedPath, vscode.ConfigurationTarget.Global);
1639+
void vscode.window.showInformationMessage(`TKVSC: RomFS path set to ${nestedPath}`);
1640+
validRomfsSelected = true;
1641+
foundNested = true;
1642+
break;
1643+
}
1644+
}
16401645
}
16411646
} catch {
16421647
// ignore
16431648
}
16441649

1645-
await vscode.window.showWarningMessage('TKVSC: The selected directory must be named "romfs" or contain a "romfs" folder. Please choose a different directory.', { modal: true });
1650+
if (foundNested) {
1651+
continue;
1652+
}
1653+
1654+
await vscode.window.showWarningMessage('TKVSC: The selected directory must contain a "Pack/ZsDic.pack.zs" file. Please choose a valid game dump directory.', { modal: true });
16461655
}
16471656
} else {
16481657
break;

0 commit comments

Comments
 (0)