Merge remote-tracking branch 'fw42/snapshot_linux_darwin'

This commit is contained in:
Alexander Neumann 2015-04-30 00:57:39 +02:00
commit a906b9febe
3 changed files with 24 additions and 56 deletions

View file

@ -3,7 +3,9 @@ package restic
import ( import (
"fmt" "fmt"
"os" "os"
"os/user"
"path/filepath" "path/filepath"
"strconv"
"time" "time"
"github.com/restic/restic/backend" "github.com/restic/restic/backend"
@ -65,3 +67,25 @@ func (sn Snapshot) String() string {
func (sn Snapshot) ID() backend.ID { func (sn Snapshot) ID() backend.ID {
return sn.id return sn.id
} }
func (sn *Snapshot) fillUserInfo() error {
usr, err := user.Current()
if err != nil {
return err
}
sn.Username = usr.Username
uid, err := strconv.ParseInt(usr.Uid, 10, 32)
if err != nil {
return err
}
sn.UID = uint32(uid)
gid, err := strconv.ParseInt(usr.Gid, 10, 32)
if err != nil {
return err
}
sn.GID = uint32(gid)
return nil
}

View file

@ -1,28 +0,0 @@
package restic
import (
"os/user"
"strconv"
)
func (sn *Snapshot) fillUserInfo() error {
usr, err := user.Current()
if err != nil {
return err
}
sn.Username = usr.Username
uid, err := strconv.ParseInt(usr.Uid, 10, 32)
if err != nil {
return err
}
sn.UID = uint32(uid)
gid, err := strconv.ParseInt(usr.Gid, 10, 32)
if err != nil {
return err
}
sn.GID = uint32(gid)
return nil
}

View file

@ -1,28 +0,0 @@
package restic
import (
"os/user"
"strconv"
)
func (sn *Snapshot) fillUserInfo() error {
usr, err := user.Current()
if err != nil {
return err
}
sn.Username = usr.Username
uid, err := strconv.ParseInt(usr.Uid, 10, 32)
if err != nil {
return err
}
sn.UID = uint32(uid)
gid, err := strconv.ParseInt(usr.Gid, 10, 32)
if err != nil {
return err
}
sn.GID = uint32(gid)
return nil
}