koishipro-core.js 1.1.3 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2386,31 +2386,29 @@ async function safeReadDir2(fs, dirPath) {
2386
2386
  }
2387
2387
  }
2388
2388
  async function collectFsDbPaths(fs, pathMod, baseDir) {
2389
- const results = [];
2390
- const baseDb = joinPath3(pathMod, baseDir, "cards.cdb");
2391
- try {
2392
- const stats = await fs.promises.stat(baseDb);
2393
- if (stats.isFile()) {
2394
- results.push(baseDb);
2395
- }
2396
- } catch {
2397
- }
2398
- const expansionsDir = joinPath3(pathMod, baseDir, "expansions");
2399
- const entries = await safeReadDir2(fs, expansionsDir);
2400
- for (const entry of entries) {
2401
- if (!entry.toLowerCase().endsWith(".cdb")) {
2402
- continue;
2403
- }
2404
- const fullPath = joinPath3(pathMod, expansionsDir, entry);
2405
- try {
2406
- const stats = await fs.promises.stat(fullPath);
2407
- if (stats.isFile()) {
2408
- results.push(fullPath);
2389
+ const collectCdbFiles = async (dirPath) => {
2390
+ const paths = [];
2391
+ const entries = await safeReadDir2(fs, dirPath);
2392
+ for (const entry of entries) {
2393
+ if (!entry.toLowerCase().endsWith(".cdb")) {
2394
+ continue;
2395
+ }
2396
+ const fullPath = joinPath3(pathMod, dirPath, entry);
2397
+ try {
2398
+ const stats = await fs.promises.stat(fullPath);
2399
+ if (stats.isFile()) {
2400
+ paths.push(fullPath);
2401
+ }
2402
+ } catch {
2403
+ continue;
2409
2404
  }
2410
- } catch {
2411
- continue;
2412
2405
  }
2413
- }
2406
+ return paths;
2407
+ };
2408
+ const results = [];
2409
+ const expansionsDir = joinPath3(pathMod, baseDir, "expansions");
2410
+ results.push(...await collectCdbFiles(expansionsDir));
2411
+ results.push(...await collectCdbFiles(baseDir));
2414
2412
  return results;
2415
2413
  }
2416
2414
  function isRootCdbEntry(entryName) {