Fixes #269. Fix beautifying PHP with CLI path set for Windows

Windows requires `php` command to interpret php-cs-fixer
This commit is contained in:
Glavin Wiechert 2015-04-07 13:59:14 -03:00
parent 712cca71f0
commit 6c8cce31c6
1 changed files with 10 additions and 1 deletions

View File

@ -20,8 +20,17 @@ getCmd = (inputPath, outputPath, options) ->
cmd = "#{levelOption} #{fixerOption} \"#{inputPath}\") || (mv \"#{inputPath}\" \"#{outputPath}\")" cmd = "#{levelOption} #{fixerOption} \"#{inputPath}\") || (mv \"#{inputPath}\" \"#{outputPath}\")"
if phpCsFixerPath if phpCsFixerPath
isWin = /^win/.test(process.platform)
# Use absolute path # Use absolute path
"(\"#{phpCsFixerPath}\" fix #{cmd}" if isWin
# Windows does require `php` prefix
# See https://github.com/Glavin001/atom-beautify/issues/269
"php (\"#{phpCsFixerPath}\" fix #{cmd}"
else
# Mac & Linux do not require `php` prefix
# See https://github.com/Glavin001/atom-beautify/pull/263
"(\"#{phpCsFixerPath}\" fix #{cmd}"
else else
# Use command available in $PATH # Use command available in $PATH
"(php-cs-fixer fix #{cmd}" "(php-cs-fixer fix #{cmd}"