~adnano/kiln

f2f6a64a1a508bd82b8c563ee183801326d4975a — Adnan Maolood 2 days ago 7ac653c master
Preserve mode bits for static files

Fixes: https://todo.sr.ht/~adnano/kiln/25
1 files changed, 7 insertions(+), 1 deletions(-)

M main.go
M main.go => main.go +7 -1
@@ 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
		}