2024-10-24 15:10:30 +01:00
|
|
|
package aghos
|
|
|
|
|
2024-10-25 15:05:08 +01:00
|
|
|
import (
|
|
|
|
"io/fs"
|
|
|
|
"os"
|
|
|
|
)
|
2024-10-24 15:10:30 +01:00
|
|
|
|
2024-10-25 13:55:16 +01:00
|
|
|
// TODO(e.burkov): Add platform-independent tests.
|
|
|
|
|
2024-10-24 15:10:30 +01:00
|
|
|
// Chmod is an extension for [os.Chmod] that properly handles Windows access
|
|
|
|
// rights.
|
|
|
|
func Chmod(name string, perm fs.FileMode) (err error) {
|
|
|
|
return chmod(name, perm)
|
|
|
|
}
|
|
|
|
|
2024-10-25 13:55:16 +01:00
|
|
|
// Mkdir is an extension for [os.Mkdir] that properly handles Windows access
|
2024-10-24 15:10:30 +01:00
|
|
|
// rights.
|
|
|
|
func Mkdir(name string, perm fs.FileMode) (err error) {
|
|
|
|
return mkdir(name, perm)
|
|
|
|
}
|
|
|
|
|
2024-10-25 13:55:16 +01:00
|
|
|
// MkdirAll is an extension for [os.MkdirAll] that properly handles Windows
|
|
|
|
// access rights.
|
|
|
|
func MkdirAll(path string, perm fs.FileMode) (err error) {
|
|
|
|
return mkdirAll(path, perm)
|
|
|
|
}
|
|
|
|
|
|
|
|
// WriteFile is an extension for [os.WriteFile] that properly handles Windows
|
|
|
|
// access rights.
|
|
|
|
func WriteFile(filename string, data []byte, perm fs.FileMode) (err error) {
|
|
|
|
return writeFile(filename, data, perm)
|
|
|
|
}
|
|
|
|
|
2024-10-25 15:05:08 +01:00
|
|
|
// OpenFile is an extension for [os.OpenFile] that properly handles Windows
|
|
|
|
// access rights.
|
|
|
|
func OpenFile(name string, flag int, perm fs.FileMode) (file *os.File, err error) {
|
|
|
|
return openFile(name, flag, perm)
|
|
|
|
}
|
|
|
|
|
2024-10-25 11:23:50 +01:00
|
|
|
// Stat is an extension for [os.Stat] that properly handles Windows access
|
|
|
|
// rights.
|
|
|
|
func Stat(name string) (fi fs.FileInfo, err error) {
|
|
|
|
return stat(name)
|
|
|
|
}
|