diff --git a/src/cli/commands/files/add.js b/src/cli/commands/files/add.js index 5f7160ff87..3d2c2741ed 100644 --- a/src/cli/commands/files/add.js +++ b/src/cli/commands/files/add.js @@ -29,13 +29,18 @@ function checkPath (inPath, recursive) { throw new Error('Error: Argument \'path\' is required') } - // Strips trailing slash from path. - inPath = inPath.replace(/\/$/, '') - if (inPath === '.') { inPath = process.cwd() } + // Convert to POSIX format + inPath = inPath + .split(path.sep) + .join('/') + + // Strips trailing slash from path. + inPath = inPath.replace(/\/$/, '') + if (fs.statSync(inPath).isDirectory() && recursive === false) { throw new Error(`Error: ${inPath} is a directory, use the '-r' flag to specify directories`) }