all: Adjust windows perms in fs package (#5200)

This commit is contained in:
Simon Frei
2018-09-16 16:09:56 +02:00
committed by GitHub
parent 60eb9088ff
commit 272fb3b444
4 changed files with 36 additions and 51 deletions

View File

@@ -10,7 +10,6 @@ package osutil
import (
"errors"
"io"
"os"
"path/filepath"
"runtime"
"strings"
@@ -136,24 +135,6 @@ func copyFileContents(filesystem fs.Filesystem, src, dst string) (err error) {
return
}
var execExts map[string]bool
func init() {
// PATHEXT contains a list of executable file extensions, on Windows
pathext := filepath.SplitList(os.Getenv("PATHEXT"))
// We want the extensions in execExts to be lower case
execExts = make(map[string]bool, len(pathext))
for _, ext := range pathext {
execExts[strings.ToLower(ext)] = true
}
}
// IsWindowsExecutable returns true if the given path has an extension that is
// in the list of executable extensions.
func IsWindowsExecutable(path string) bool {
return execExts[strings.ToLower(filepath.Ext(path))]
}
func IsDeleted(ffs fs.Filesystem, name string) bool {
if _, err := ffs.Lstat(name); fs.IsNotExist(err) {
return true