Skip to content

Commit 84f1d3d

Browse files
committed
fixing path separator
1 parent ec53010 commit 84f1d3d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/crawler/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const fs = require('fs');
2-
const { join } = require('path');
2+
const { join, sep } = require('path');
33

44
function getDetails(data) {
55
const matadata = data.match(/---(.*\n)*---/)[0];
@@ -27,15 +27,15 @@ function getFolders(source) {
2727
const edges = allContent.filter(isFile).map(file => {
2828
const data = fs.readFileSync(file, 'utf-8');
2929
return {
30-
id: file.substr(file.lastIndexOf('/') + 1),
30+
id: file.substr(file.lastIndexOf(sep) + 1),
3131
path: file,
3232
details: getDetails(data),
3333
preview: getPreview(data)
3434
};
3535
});
3636
const nodes = allContent.filter(isDirectory).map(dir => getFolders(dir));
3737
const result = {
38-
id: source.substr(source.lastIndexOf('/') + 1)
38+
id: source.substr(source.lastIndexOf(sep) + 1)
3939
};
4040
if (nodes.length) {
4141
result.nodes = nodes;

0 commit comments

Comments
 (0)