Skip to content

Commit

Permalink
core: cygwin_path only uses cygpath in cygwin [GH-3804]
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed May 17, 2014
1 parent 34b7cac commit 6353c76
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ BUG FIXES:
and exit status behind. [GH-3729]
- synced\_folders/rsync: `rsync__chown` can be set to `false` to
disable recursive chown after sync. [GH-3810]
- synced\_folders/rsync: Use a proper msys path if not in
Cygwin. [GH-3804]

## 1.6.2 (May 12, 2014)

Expand Down
29 changes: 16 additions & 13 deletions lib/vagrant/util/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,23 @@ def windows_admin?
# @param [String] path
# @return [String]
def cygwin_path(path)
begin
# First try the real cygpath
process = Subprocess.execute("cygpath", "-u", "-a", path.to_s)
return process.stdout.chomp
rescue Errors::CommandUnavailableWindows
# Sometimes cygpath isn't available (msys). Instead, do what we
# can with bash tricks.
process = Subprocess.execute(
"bash",
"--noprofile",
"--norc",
"-c", "cd #{Shellwords.escape(path)} && pwd")
return process.stdout.chomp
if cygwin?
begin
# First try the real cygpath
process = Subprocess.execute("cygpath", "-u", "-a", path.to_s)
return process.stdout.chomp
rescue Errors::CommandUnavailableWindows
end
end

# Sometimes cygpath isn't available (msys). Instead, do what we
# can with bash tricks.
process = Subprocess.execute(
"bash",
"--noprofile",
"--norc",
"-c", "cd #{Shellwords.escape(path)} && pwd")
return process.stdout.chomp
end

# This takes any path and converts it to a full-length Windows
Expand Down

0 comments on commit 6353c76

Please sign in to comment.