22 lines
318 B
Go
22 lines
318 B
Go
//go:build !windows
|
|
|
|
package archive
|
|
|
|
import "os"
|
|
|
|
func atomicReplace(from, to string) error {
|
|
return os.Rename(from, to)
|
|
}
|
|
|
|
func syncDirectory(path string) error {
|
|
dir, err := os.Open(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if err := dir.Sync(); err != nil {
|
|
_ = dir.Close()
|
|
return err
|
|
}
|
|
return dir.Close()
|
|
}
|