Release 0.0.2
This commit is contained in:
@@ -14,7 +14,13 @@ const worldSystemId = worldManifest.system ?? null;
|
||||
|
||||
async function* walkDirectory(storage, baseDir, relativeDir = "") {
|
||||
const absoluteDir = path.join(baseDir, relativeDir);
|
||||
const entries = await fs.readdir(absoluteDir, { withFileTypes: true });
|
||||
let entries;
|
||||
try {
|
||||
entries = await fs.readdir(absoluteDir, { withFileTypes: true });
|
||||
} catch (error) {
|
||||
if (error?.code === "ENOENT") return;
|
||||
throw error;
|
||||
}
|
||||
for (const entry of entries) {
|
||||
const relativePath = normalizePath(path.posix.join(relativeDir, entry.name));
|
||||
if (entry.isDirectory()) {
|
||||
@@ -22,7 +28,13 @@ async function* walkDirectory(storage, baseDir, relativeDir = "") {
|
||||
continue;
|
||||
}
|
||||
if (!isMediaPath(relativePath)) continue;
|
||||
const stat = await fs.stat(path.join(baseDir, relativePath));
|
||||
let stat;
|
||||
try {
|
||||
stat = await fs.stat(path.join(baseDir, relativePath));
|
||||
} catch (error) {
|
||||
if (error?.code === "ENOENT") continue;
|
||||
throw error;
|
||||
}
|
||||
yield { storage, path: relativePath, size: stat.size };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user