Skip to content

Commit

Permalink
separate syscall to avoid breaking the windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
gyepisam committed Feb 6, 2014
1 parent 7bc941e commit c36ac80
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
5 changes: 2 additions & 3 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ const (
// AUTO marks system generated event records.
AUTO = "auto"

// Directory creation permission mode
const DIR_PERM = 0755
// Directory creation permission mode
DIR_PERM = 0755
)

// Dependency Relations
Expand All @@ -37,7 +37,6 @@ const (
REQUIRES Relation = "requires"
)


// makeKey returns a database key consisting of provided arguments, joined with KEY_SEPARATOR
// and prefixed with the PathHash.
func (f *File) makeKey(subkeys ...interface{}) (val string) {
Expand Down
10 changes: 0 additions & 10 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"os"
"path/filepath"
"strings"
"syscall"

"github.com/gyepisam/fileutils"
)
Expand Down Expand Up @@ -327,12 +326,3 @@ func (f *File) NewOutput(isArg3 bool) (*Output, error) {
}
return &Output{tmp, isArg3}, nil
}

func statUidGid(finfo os.FileInfo) (uint32, uint32, error) {
sys := finfo.Sys()
if sys == nil {
return 0, 0, errors.New("finfo.Sys() is unsupported")
}
stat := sys.(*syscall.Stat_t)
return stat.Uid, stat.Gid, nil
}
18 changes: 18 additions & 0 deletions stat.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// +build !windows

package redux

import (
"errors"
"os"
"syscall"
)

func statUidGid(finfo os.FileInfo) (uint32, uint32, error) {
sys := finfo.Sys()
if sys == nil {
return 0, 0, errors.New("finfo.Sys() is unsupported")
}
stat := sys.(*syscall.Stat_t)
return stat.Uid, stat.Gid, nil
}
12 changes: 12 additions & 0 deletions stat_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// +build windows

package redux

import (
"errors"
"os"
)

func statUidGid(finfo os.FileInfo) (uint32, uint32, error) {
return 0, 0, errors.New("finfo.Sys() is unsupported")
}

0 comments on commit c36ac80

Please sign in to comment.