diff options
| author | Alex Brainman <alex.brainman@gmail.com> | 2011-05-17 12:33:36 +1000 |
|---|---|---|
| committer | Alex Brainman <alex.brainman@gmail.com> | 2011-05-17 12:33:36 +1000 |
| commit | 5342aedeed54606fa1dcad2f039744fabfcc7544 (patch) | |
| tree | 9d387d1e5db489e576472c8d09b8512b869ab7b8 /src/pkg/path/filepath/path.go | |
| parent | f570d9d7657edcccb52b2ec9a55cb90a28602d57 (diff) | |
| download | go-5342aedeed54606fa1dcad2f039744fabfcc7544.tar.xz | |
filepath: make EvalSymlinks work on Windows
Fixes #1830.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4526060
Diffstat (limited to 'src/pkg/path/filepath/path.go')
| -rw-r--r-- | src/pkg/path/filepath/path.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pkg/path/filepath/path.go b/src/pkg/path/filepath/path.go index 541a233066..6917218dbe 100644 --- a/src/pkg/path/filepath/path.go +++ b/src/pkg/path/filepath/path.go @@ -9,6 +9,7 @@ package filepath import ( "bytes" "os" + "runtime" "sort" "strings" ) @@ -178,6 +179,14 @@ func Ext(path string) string { // links. // If path is relative it will be evaluated relative to the current directory. func EvalSymlinks(path string) (string, os.Error) { + if runtime.GOOS == "windows" { + // Symlinks are not supported under windows. + _, err := os.Lstat(path) + if err != nil { + return "", err + } + return Clean(path), nil + } const maxIter = 255 originalPath := path // consume path by taking each frontmost path element, |
