aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8.1/libgo/go/path/filepath/symlink_windows.go
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8.1/libgo/go/path/filepath/symlink_windows.go')
-rw-r--r--gcc-4.8.1/libgo/go/path/filepath/symlink_windows.go69
1 files changed, 0 insertions, 69 deletions
diff --git a/gcc-4.8.1/libgo/go/path/filepath/symlink_windows.go b/gcc-4.8.1/libgo/go/path/filepath/symlink_windows.go
deleted file mode 100644
index 9adc8a48a..000000000
--- a/gcc-4.8.1/libgo/go/path/filepath/symlink_windows.go
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package filepath
-
-import (
- "syscall"
-)
-
-func toShort(path string) (string, error) {
- p, err := syscall.UTF16FromString(path)
- if err != nil {
- return "", err
- }
- b := p // GetShortPathName says we can reuse buffer
- n, err := syscall.GetShortPathName(&p[0], &b[0], uint32(len(b)))
- if err != nil {
- return "", err
- }
- if n > uint32(len(b)) {
- b = make([]uint16, n)
- n, err = syscall.GetShortPathName(&p[0], &b[0], uint32(len(b)))
- if err != nil {
- return "", err
- }
- }
- return syscall.UTF16ToString(b), nil
-}
-
-func toLong(path string) (string, error) {
- p, err := syscall.UTF16FromString(path)
- if err != nil {
- return "", err
- }
- b := p // GetLongPathName says we can reuse buffer
- n, err := syscall.GetLongPathName(&p[0], &b[0], uint32(len(b)))
- if err != nil {
- return "", err
- }
- if n > uint32(len(b)) {
- b = make([]uint16, n)
- n, err = syscall.GetLongPathName(&p[0], &b[0], uint32(len(b)))
- if err != nil {
- return "", err
- }
- }
- b = b[:n]
- return syscall.UTF16ToString(b), nil
-}
-
-func evalSymlinks(path string) (string, error) {
- p, err := toShort(path)
- if err != nil {
- return "", err
- }
- p, err = toLong(p)
- if err != nil {
- return "", err
- }
- // syscall.GetLongPathName does not change the case of the drive letter,
- // but the result of EvalSymlinks must be unique, so we have
- // EvalSymlinks(`c:\a`) == EvalSymlinks(`C:\a`).
- // Make drive letter upper case.
- if len(p) >= 2 && p[1] == ':' && 'a' <= p[0] && p[0] <= 'z' {
- p = string(p[0]+'A'-'a') + p[1:]
- }
- return Clean(p), nil
-}