From 53cfdbebc8e6f5bf5284ac5362d24688e1060a73 Mon Sep 17 00:00:00 2001 From: Richard Schneider Date: Sat, 25 Nov 2017 16:44:47 +1300 Subject: [PATCH] fix(files.add): glob needs a POSIX path --- src/cli/commands/files/add.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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`) }