Skip to content

Commit

Permalink
use path.sep
Browse files Browse the repository at this point in the history
  • Loading branch information
yecnj committed Jan 6, 2025
1 parent 586c4d7 commit f59a9ed
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function _buildPageManifest(pages) {
isPage: false
};
for (const [pagePath, pageContent] of Object.entries(pages)) {
const path = pagePath.replace('src/pages/', '');
const path = pagePath.replace('/src/pages/', '');
let node = fileTree;
for (const part of path.split('/')) {
if (part === '+page.md') {
Expand Down Expand Up @@ -71,7 +71,7 @@ export async function GET() {
const relative_path = path.join(dirent.parentPath ?? dirent.path ?? dir, dirent.name);
const content = await fs.readFile(relative_path, 'utf-8');
// regularize for windows
const normalized_path = path.normalize(relative_path).replace('\\', '/');
const normalized_path = path.normalize(relative_path).split(path.sep).join('/');
pages[normalized_path] = content;
} else if (dirent.isDirectory()) {
await recursiveReadDir(path.join(dir, dirent.name));
Expand Down

0 comments on commit f59a9ed

Please sign in to comment.