diff --git a/list_test.go b/list_test.go index d07dfac5..e265abf7 100644 --- a/list_test.go +++ b/list_test.go @@ -59,11 +59,13 @@ func TestCommandListUnknown(t *testing.T) { func sortLines(s string) string { ss := strings.Split(strings.TrimSpace(s), "\n") sort.Strings(ss) + /* mattn if runtime.GOOS == "windows" { for i, p := range ss { ss[i] = toFullPath(p) } } + */ return strings.Join(ss, "\n") } diff --git a/local_repository.go b/local_repository.go index bc6a2e41..121980c1 100644 --- a/local_repository.go +++ b/local_repository.go @@ -42,11 +42,11 @@ func LocalRepositoryFromFullPath(fullPath string, backend *VCSBackend) (*LocalRe return nil, err } - fullPath = toFullPath(fullPath) + //fullPath = toFullPath(fullPath) var root string for _, root = range roots { - root = toFullPath(root) + //root = toFullPath(root) if !strings.HasPrefix(fullPath, root) { continue } diff --git a/local_repository_windows.go b/local_repository_windows.go index b0e71602..36027d83 100644 --- a/local_repository_windows.go +++ b/local_repository_windows.go @@ -2,25 +2,24 @@ package main +import "syscall" + func toFullPath(s string) string { - /* - p := syscall.StringToUTF16(s) - b := p - n, err := syscall.GetLongPathName(&p[0], &b[0], uint32(len(b))) + p := syscall.StringToUTF16(s) + b := p + n, err := syscall.GetLongPathName(&p[0], &b[0], uint32(len(b))) + if err != nil { + println("error", err.Error()) + return s + } + if n > uint32(len(b)) { + b = make([]uint16, n) + n, err = syscall.GetLongPathName(&p[0], &b[0], uint32(len(b))) if err != nil { println("error", err.Error()) return s } - if n > uint32(len(b)) { - b = make([]uint16, n) - n, err = syscall.GetLongPathName(&p[0], &b[0], uint32(len(b))) - if err != nil { - println("error", err.Error()) - return s - } - } - b = b[:n] - return syscall.UTF16ToString(b) - */ - return s + } + b = b[:n] + return syscall.UTF16ToString(b) }