mirror of
https://git.sr.ht/~adnano/kiln
synced 2024-10-30 09:23:09 +00:00
Preserve mode bits for static files
Fixes: https://todo.sr.ht/~adnano/kiln/25
This commit is contained in:
parent
7ac653c620
commit
f2f6a64a1a
8
main.go
8
main.go
|
@ -114,9 +114,15 @@ func copyAll(srcDir, dstDir string) error {
|
|||
}
|
||||
defer src.Close()
|
||||
|
||||
sinfo, err := src.Stat()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mode := sinfo.Mode()
|
||||
|
||||
dstPath := filepath.Join(dstDir, strings.TrimPrefix(path, srcDir))
|
||||
os.MkdirAll(filepath.Dir(dstPath), 0755)
|
||||
dst, err := os.Create(dstPath)
|
||||
dst, err := os.OpenFile(dstPath, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, mode)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue