It will help for us to rename earlier vs later, and syscallfs will be laborious, especially after we introduce an FSConfig type and need to declare a method name that differentiates from normal fs.FS. e.g. WithFS vs WithSysFS reads nicer than WithSyscallFS, and meanwhile sys is already a public package. Signed-off-by: Adrian Cole <adrian@tetrate.io>
29 lines
396 B
Go
29 lines
396 B
Go
//go:build !windows
|
|
|
|
package sysfs
|
|
|
|
import "syscall"
|
|
|
|
func adjustMkdirError(err error) error {
|
|
return err
|
|
}
|
|
|
|
func adjustRmdirError(err error) error {
|
|
return err
|
|
}
|
|
|
|
func adjustUnlinkError(err error) error {
|
|
if err == syscall.EPERM {
|
|
return syscall.EISDIR
|
|
}
|
|
return err
|
|
}
|
|
|
|
func rename(old, new string) error {
|
|
return syscall.Rename(old, new)
|
|
}
|
|
|
|
func maybeWrapFile(f file) file {
|
|
return f
|
|
}
|