11
vendor/github.com/mrunalp/fileutils/fileutils.go
generated
vendored
11
vendor/github.com/mrunalp/fileutils/fileutils.go
generated
vendored
@@ -125,6 +125,7 @@ func CopyDirectory(source string, dest string) error {
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
destPath := filepath.Join(dest, relPath)
|
||||
|
||||
if info.IsDir() {
|
||||
// Skip the source directory.
|
||||
@@ -138,18 +139,20 @@ func CopyDirectory(source string, dest string) error {
|
||||
uid := int(st.Uid)
|
||||
gid := int(st.Gid)
|
||||
|
||||
if err := os.Mkdir(filepath.Join(dest, relPath), info.Mode()); err != nil {
|
||||
if err := os.Mkdir(destPath, info.Mode()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.Lchown(filepath.Join(dest, relPath), uid, gid); err != nil {
|
||||
if err := os.Lchown(destPath, uid, gid); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := os.Chmod(destPath, info.Mode()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
return CopyFile(path, filepath.Join(dest, relPath))
|
||||
return CopyFile(path, destPath)
|
||||
})
|
||||
}
|
||||
|
||||
|
3
vendor/github.com/mrunalp/fileutils/idtools.go
generated
vendored
3
vendor/github.com/mrunalp/fileutils/idtools.go
generated
vendored
@@ -49,6 +49,9 @@ func MkdirAllNewAs(path string, mode os.FileMode, ownerUID, ownerGID int) error
|
||||
if err := os.Chown(pathComponent, ownerUID, ownerGID); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := os.Chmod(pathComponent, mode); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user