Permalink
Browse files

Make fast-archiver build on Windows

partially functional; file modes and owners are not preserved
  • Loading branch information...
1 parent 860b1dc commit 6b8e030ecce80a4126a7ee1b184244c229dea225 @mfenniak mfenniak committed Sep 4, 2012
Showing with 41 additions and 21 deletions.
  1. +1 −0 .gitattributes
  2. +1 −0 .gitignore
  3. +0 −21 falib/archiver.go
  4. +26 −0 falib/util_linux.go
  5. +13 −0 falib/util_windows.go
View
@@ -0,0 +1 @@
+* -text
View
@@ -1,3 +1,4 @@
fast-archiver
+fast-archiver.exe
*.swp
*.swo
View
@@ -10,7 +10,6 @@ import (
"path/filepath"
"strings"
"sync"
- "syscall"
)
type Archiver struct {
@@ -149,26 +148,6 @@ func (a *Archiver) directoryScanner() {
}
}
-func (a *Archiver) getModeOwnership(file *os.File) (int, int, os.FileMode) {
- var uid int = 0
- var gid int = 0
- var mode os.FileMode = 0
- fi, err := file.Stat()
- if err != nil {
- a.Logger.Warning("file stat error; uid/gid/mode will be incorrect:", err.Error())
- } else {
- mode = fi.Mode()
- stat_t := fi.Sys().(*syscall.Stat_t)
- if stat_t != nil {
- uid = int(stat_t.Uid)
- gid = int(stat_t.Gid)
- } else {
- a.Logger.Warning("unable to find file uid/gid")
- }
- }
- return uid, gid, mode
-}
-
func (a *Archiver) fileReader() {
for filePath := range a.fileReadQueue {
a.Logger.Verbose(filePath)
View
@@ -0,0 +1,26 @@
+package falib
+
+import (
+ "os"
+ "syscall"
+)
+
+func (a *Archiver) getModeOwnership(file *os.File) (int, int, os.FileMode) {
+ var uid int = 0
+ var gid int = 0
+ var mode os.FileMode = 0
+ fi, err := file.Stat()
+ if err != nil {
+ a.Logger.Warning("file stat error; uid/gid/mode will be incorrect:", err.Error())
+ } else {
+ mode = fi.Mode()
+ stat_t := fi.Sys().(*syscall.Stat_t)
+ if stat_t != nil {
+ uid = int(stat_t.Uid)
+ gid = int(stat_t.Gid)
+ } else {
+ a.Logger.Warning("unable to find file uid/gid")
+ }
+ }
+ return uid, gid, mode
+}
View
@@ -0,0 +1,13 @@
+package falib
+
+import "os"
+
+func (a *Archiver) getModeOwnership(file *os.File) (uid int, gid int, mode os.FileMode) {
+ fi, err := file.Stat()
+ if err != nil {
+ a.Logger.Warning("file stat error; uid/gid/mode will be incorrect:", err.Error())
+ } else {
+ mode = fi.Mode()
+ }
+ return
+}

0 comments on commit 6b8e030

Please sign in to comment.