Skip to content

Commit

Permalink
Fixes #269. Fix beautifying PHP with CLI path set for Windows
Browse files Browse the repository at this point in the history
Windows requires `php` command to interpret php-cs-fixer
  • Loading branch information
Glavin001 committed Apr 7, 2015
1 parent 712cca7 commit 6c8cce3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/langs/php-beautify.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,17 @@ getCmd = (inputPath, outputPath, options) ->
cmd = "#{levelOption} #{fixerOption} \"#{inputPath}\") || (mv \"#{inputPath}\" \"#{outputPath}\")"

if phpCsFixerPath
isWin = /^win/.test(process.platform)
# 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
# Use command available in $PATH
"(php-cs-fixer fix #{cmd}"
Expand Down

0 comments on commit 6c8cce3

Please sign in to comment.