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.mjs CHANGED
@@ -2298,31 +2298,29 @@ async function safeReadDir2(fs, dirPath) {
2298
2298
  }
2299
2299
  }
2300
2300
  async function collectFsDbPaths(fs, pathMod, baseDir) {
2301
- const results = [];
2302
- const baseDb = joinPath3(pathMod, baseDir, "cards.cdb");
2303
- try {
2304
- const stats = await fs.promises.stat(baseDb);
2305
- if (stats.isFile()) {
2306
- results.push(baseDb);
2307
- }
2308
- } catch {
2309
- }
2310
- const expansionsDir = joinPath3(pathMod, baseDir, "expansions");
2311
- const entries = await safeReadDir2(fs, expansionsDir);
2312
- for (const entry of entries) {
2313
- if (!entry.toLowerCase().endsWith(".cdb")) {
2314
- continue;
2315
- }
2316
- const fullPath = joinPath3(pathMod, expansionsDir, entry);
2317
- try {
2318
- const stats = await fs.promises.stat(fullPath);
2319
- if (stats.isFile()) {
2320
- results.push(fullPath);
2301
+ const collectCdbFiles = async (dirPath) => {
2302
+ const paths = [];
2303
+ const entries = await safeReadDir2(fs, dirPath);
2304
+ for (const entry of entries) {
2305
+ if (!entry.toLowerCase().endsWith(".cdb")) {
2306
+ continue;
2307
+ }
2308
+ const fullPath = joinPath3(pathMod, dirPath, entry);
2309
+ try {
2310
+ const stats = await fs.promises.stat(fullPath);
2311
+ if (stats.isFile()) {
2312
+ paths.push(fullPath);
2313
+ }
2314
+ } catch {
2315
+ continue;
2321
2316
  }
2322
- } catch {
2323
- continue;
2324
2317
  }
2325
- }
2318
+ return paths;
2319
+ };
2320
+ const results = [];
2321
+ const expansionsDir = joinPath3(pathMod, baseDir, "expansions");
2322
+ results.push(...await collectCdbFiles(expansionsDir));
2323
+ results.push(...await collectCdbFiles(baseDir));
2326
2324
  return results;
2327
2325
  }
2328
2326
  function isRootCdbEntry(entryName) {