dvpl free dir

This commit is contained in:
tresabhi committed 2026-08-11 09:45:17 -05:00
1 parent c130da7f0e
commit dcda627518
7 files changed
+16 -8

No files matched your search

+1 -1
View File
@@ -30,7 +30,7 @@
"@octokit/plugin-throttling": "^11.0.1", "@octokit/plugin-throttling": "^11.0.1",
"@octokit/rest": "^22.0.0", "@octokit/rest": "^22.0.0",
"@types/adm-zip": "^0.5.7", "@types/adm-zip": "^0.5.7",
"@types/bun": "^1.3.1", "@types/bun": "^1.3.14",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/lz4js": "^0.2.1", "@types/lz4js": "^0.2.1",
"@types/three": "^0.180.0", "@types/three": "^0.180.0",
+1 -1
View File
@@ -9,7 +9,7 @@
"@octokit/plugin-throttling": "^11.0.1", "@octokit/plugin-throttling": "^11.0.1",
"@octokit/rest": "^22.0.0", "@octokit/rest": "^22.0.0",
"@types/adm-zip": "^0.5.7", "@types/adm-zip": "^0.5.7",
"@types/bun": "^1.3.1", "@types/bun": "^1.3.14",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/lz4js": "^0.2.1", "@types/lz4js": "^0.2.1",
"@types/three": "^0.180.0", "@types/three": "^0.180.0",
+10 -2
View File
@@ -46,7 +46,15 @@ export abstract class AbstractVFS {
return buffer; return buffer;
} }
abstract dir(path: string): Promise<string[]>; protected abstract _dir(path: string): Promise<string[]>;
async dir(path: string) {
const files = await this._dir(path);
return files.map((file) =>
file.endsWith(".dvpl") ? file.slice(0, -5) : file,
);
}
async text(path: string) { async text(path: string) {
const file = await this.file(path); const file = await this.file(path);
@@ -63,7 +71,7 @@ export abstract class AbstractVFS {
return this.xmlParser.parse(file) as Type; return this.xmlParser.parse(file) as Type;
} }
async _csv(text: string, options: Options = {}) { protected async _csv(text: string, options: Options = {}) {
const parsed = parseCSV(text, options); const parsed = parseCSV(text, options);
return parsed; return parsed;
} }
+1 -1
View File
@@ -23,7 +23,7 @@ export class LocalVFS extends AbstractVFS {
return array; return array;
} }
async dir(path: string) { async _dir(path: string) {
try { try {
return await readdir(`${this.base}/${path}`); return await readdir(`${this.base}/${path}`);
} catch (_) { } catch (_) {
+1 -1
View File
@@ -35,7 +35,7 @@ export class MixedVFS extends AbstractVFS {
throw new Error(`File not found: ${path}`); throw new Error(`File not found: ${path}`);
} }
async dir(path: string) { async _dir(path: string) {
const files = new Set<string>(); const files = new Set<string>();
for (const vfs of this.vfses) { for (const vfs of this.vfses) {
+1 -1
View File
@@ -89,7 +89,7 @@ export class SteamVFS extends AbstractVFS {
return new Uint8Array(downloaded.file); return new Uint8Array(downloaded.file);
} }
async dir(path: string) { async _dir(path: string) {
const parentSegments = path.split("/").length; const parentSegments = path.split("/").length;
const children = new Set<string>(); const children = new Set<string>();
+1 -1
View File
@@ -33,7 +33,7 @@ export class ZipVFS extends AbstractVFS {
return new Uint8Array(arrayBuffer); return new Uint8Array(arrayBuffer);
} }
async dir(path: string) { async _dir(path: string) {
const parentSegments = path.split("/").length; const parentSegments = path.split("/").length;
const children = new Set<string>(); const children = new Set<string>();