Skip to content

Commit

Permalink
osfs: remove fix for Stat in windows
Browse files Browse the repository at this point in the history
Signed-off-by: Máximo Cuadros <[email protected]>
  • Loading branch information
mcuadros committed Nov 18, 2017
1 parent 425453e commit 198f713
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 30 deletions.
4 changes: 4 additions & 0 deletions osfs/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ func (fs *OS) Open(filename string) (billy.File, error) {
return fs.OpenFile(filename, os.O_RDONLY, 0)
}

func (fs *OS) Stat(filename string) (os.FileInfo, error) {
return os.Stat(filename)
}

func (fs *OS) Remove(filename string) error {
return os.Remove(filename)
}
Expand Down
5 changes: 0 additions & 5 deletions osfs/os_posix.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@
package osfs

import (
"os"
"syscall"
)

func (fs *OS) Stat(filename string) (os.FileInfo, error) {
return os.Stat(filename)
}

func (f *file) Lock() error {
f.m.Lock()
defer f.m.Unlock()
Expand Down
25 changes: 0 additions & 25 deletions osfs/os_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,12 @@ package osfs

import (
"os"
"path/filepath"
"runtime"
"strings"
"unsafe"

"golang.org/x/sys/windows"
)

// Stat returns the FileInfo structure describing file.
func (fs *OS) Stat(filename string) (os.FileInfo, error) {
// TODO: remove this in Go 1.9
target, err := fs.Readlink(filename)
if err != nil {
return os.Stat(filename)
}

if !filepath.IsAbs(target) && !strings.HasPrefix(target, string(filepath.Separator)) {
target = fs.Join(filepath.Dir(filename), target)
}

fi, err := fs.Stat(target)
if err != nil {
return nil, err
}

return &fileInfo{
FileInfo: fi,
name: filepath.Base(filename),
}, nil
}

type fileInfo struct {
os.FileInfo
name string
Expand Down

0 comments on commit 198f713

Please sign in to comment.