Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
Sanitize path variables to accommodate spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Neel Shah authored and dhruvkb committed Jan 23, 2020
1 parent 3954bd7 commit 341de8f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions documentation/variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,24 @@ const verboseName = packageConfig.verboseName

const rootDir = path.resolve(__dirname, '..')

const srcDir = path.resolve(rootDir, 'src')
const docsDir = path.resolve(rootDir, 'docs')
const storybookDir = path.resolve(docsDir, 'storybook')
let srcDir = path.resolve(rootDir, 'src')
let docsDir = path.resolve(rootDir, 'docs')
let storybookDir = path.resolve(docsDir, 'storybook')

const sanitizePath = (path) => {
if(process.platform != 'win32'){
let tokens = path.split("/")
tokens = tokens.map(token => token.replace(/(\s+)/g, '\\$1'))
return tokens.join("/")
}
else{
return path
}
}

srcDir = sanitizePath(srcDir)
docsDir = sanitizePath(docsDir)
storybookDir = sanitizePath(storybookDir)

module.exports = {
verboseName,
Expand Down

0 comments on commit 341de8f

Please sign in to comment.