Skip to content

Commit 3f187f0

Browse files
authored
fix: generate wrong detect relative path on Windows (#192)
1 parent 11f0367 commit 3f187f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/commands/generate.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ function genSidebar(cwdPath, sidebarPath) {
3636
let nodeName = ''
3737
getDirFiles(cwdPath, function (pathname) {
3838
path.relative(pathname, cwdPath)
39-
pathname = pathname.replace(cwdPath + '/', '')
39+
pathname = pathname.replace(cwdPath + path.sep, '')
4040
let filename = path.basename(pathname, '.md')
4141
let splitPath = pathname.split(path.sep)
4242

4343
if (ignoreFiles.indexOf(filename) !== -1) {
4444
return true
4545
}
4646

47-
nodeName = '- [' + toCamelCase(filename) + '](' + pathname + ')' + os.EOL
47+
nodeName = '- [' + toCamelCase(filename) + '](' + pathname.replace(/\\/g, '/') + ')' + os.EOL
4848

4949
if (splitPath.length > 1) {
5050
if (splitPath[0] !== lastPath) {

0 commit comments

Comments
 (0)