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

CLI recursive file add on windows #1108

Merged
merged 1 commit into from
Nov 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/cli/commands/files/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
}
Expand Down