@@ -24,20 +24,20 @@ function execute(command) {
24
24
}
25
25
26
26
function readFiles ( directory , filelist ) {
27
- if ( directory [ directory . length - 1 ] != '/' ) {
28
- directory = directory . concat ( '/' ) ;
27
+ if ( directory [ directory . length - 1 ] != ` ${ path . sep } ` ) {
28
+ directory = directory . concat ( ` ${ path . sep } ` ) ;
29
29
}
30
30
31
31
const files = fs . readdirSync ( directory ) ;
32
32
filelist = filelist || [ ] ;
33
33
files . forEach ( ( file ) => {
34
34
if ( fs . statSync ( directory + file ) . isDirectory ( ) ) {
35
- filelist = readFiles ( directory + file + '/' , filelist ) ;
35
+ filelist = readFiles ( directory + file + ` ${ path . sep } ` , filelist ) ;
36
36
} else {
37
37
const originalPath = directory + file ;
38
38
const newPath = path . join ( outputPath , originalPath
39
- . replace ( documentationPath + '/' , '' )
40
- . replace ( '/' , '-' ) ) ;
39
+ . replace ( documentationPath + ` ${ path . sep } ` , '' )
40
+ . replace ( ` ${ path . sep } ` , '-' ) ) ;
41
41
42
42
filelist . push ( { originalPath, newPath } ) ;
43
43
}
@@ -81,8 +81,11 @@ function createFiles() {
81
81
82
82
function checkNameLinks ( files ) {
83
83
return files . reduce ( ( pValue , cValue ) => {
84
- const oldName = cValue . originalPath . split ( '/' ) . slice ( - 1 ) . pop ( ) . replace ( '.md' , '' ) ;
85
- const newName = '(' + cValue . newPath . split ( '/' ) . slice ( - 1 ) . pop ( ) . replace ( '.md' , '' ) + ')' ;
84
+ const oldName = cValue . originalPath
85
+ . replace ( documentationPath + `${ path . sep } ` , '' )
86
+ . replace ( '.md' , '' )
87
+ . replace ( `${ path . sep } ` , '/' )
88
+ const newName = '(' + cValue . newPath . split ( `${ path . sep } ` ) . slice ( - 1 ) . pop ( ) . replace ( '.md' , '' ) + ')' ;
86
89
if ( oldName !== newName ) {
87
90
pValue . push ( {
88
91
oldName,
0 commit comments