posix: Support UNC paths on windows. (#1887)

This allows us to now use 32K paths names on windows.

Fixes #1620
This commit is contained in:
Harshavardhana
2016-06-13 15:23:09 +05:30
committed by Anand Babu (AB) Periasamy
parent 4ab57f7d60
commit ed4fe689b4
13 changed files with 379 additions and 83 deletions
+5 -3
View File
@@ -19,6 +19,7 @@
package main
import (
"fmt"
"io"
"os"
"strings"
@@ -26,10 +27,11 @@ import (
// Return all the entries at the directory dirPath.
func readDir(dirPath string) (entries []string, err error) {
d, err := os.Open(dirPath)
d, err := os.Open(preparePath(dirPath))
if err != nil {
// File is really not found.
if os.IsNotExist(err) {
fmt.Println(preparePath(dirPath), err)
return nil, errFileNotFound
}
@@ -50,12 +52,12 @@ func readDir(dirPath string) (entries []string, err error) {
return nil, err
}
for _, fi := range fis {
// Skip special files.
// Skip special files, if found.
if hasPosixReservedPrefix(fi.Name()) {
continue
}
if fi.Mode().IsDir() {
// append "/" instead of "\" so that sorting is done as expected.
// Append "/" instead of "\" so that sorting is achieved as expected.
entries = append(entries, fi.Name()+slashSeparator)
} else if fi.Mode().IsRegular() {
entries = append(entries, fi.Name())