Skip to content

Commit

Permalink
Use posix paths
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic committed Jun 12, 2024
1 parent ccb77a0 commit 11030b4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/astro/src/content/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,20 @@ export async function getSymlinkedContentCollections(
const contentPaths = new Map<string, string>();
const contentDirPath = fileURLToPath(contentDir);

if(!fsMod.existsSync(contentDirPath) || !fsMod.lstatSync(contentDirPath).isDirectory()) {
if (!fsMod.existsSync(contentDirPath) || !fsMod.lstatSync(contentDirPath).isDirectory()) {
return contentPaths;
}

const contentDirEntries = await fsMod.promises.readdir(contentDir, { withFileTypes: true });
for (const entry of contentDirEntries) {
if (entry.isSymbolicLink()) {
const entryPath = path.join(contentDirPath, entry.name);
const entryPath = path.resolve(contentDirPath, entry.name);
const realPath = await fsMod.promises.realpath(entryPath);
contentPaths.set(realPath, entry.name);
// Normalize path separators to posix to match Vite identifiers
contentPaths.set(path.posix.resolve(realPath), entry.name);
}
}
console.log({contentPaths})
console.log({contentPaths });
return contentPaths;
}

Expand Down

0 comments on commit 11030b4

Please sign in to comment.