impr: engine - copy files with 444 permissions

This commit is contained in:
Anton
2024-01-17 23:27:59 +05:00
parent 3fd59120f5
commit 314987ae43
3 changed files with 26 additions and 5 deletions

View File

@@ -14,7 +14,7 @@ import (
// CopyFile copies all files matching the pattern
// to the destination directory.
func CopyFiles(pattern string, dstDir string) error {
func CopyFiles(pattern string, dstDir string, perm fs.FileMode) error {
matches, err := filepath.Glob(pattern)
if err != nil {
return err
@@ -28,7 +28,7 @@ func CopyFiles(pattern string, dstDir string) error {
defer src.Close()
dstFile := filepath.Join(dstDir, filepath.Base(match))
dst, err := os.Create(dstFile)
dst, err := os.OpenFile(dstFile, os.O_RDWR|os.O_CREATE|os.O_TRUNC, perm)
if err != nil {
return err
}