2015-08-16 12:39:38 +02:00
|
|
|
package local
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"os"
|
2025-11-15 20:59:14 -05:00
|
|
|
|
|
|
|
|
"github.com/restic/restic/internal/errors"
|
2015-08-16 12:39:38 +02:00
|
|
|
)
|
|
|
|
|
|
2021-07-09 17:11:39 +02:00
|
|
|
// Can't explicitly flush directory changes on Windows.
|
2025-02-28 19:52:43 +00:00
|
|
|
func fsyncDir(_ string) error { return nil }
|
2021-07-09 17:11:39 +02:00
|
|
|
|
2022-11-11 14:53:42 +01:00
|
|
|
// Windows is not macOS.
|
2025-02-28 19:52:43 +00:00
|
|
|
func isMacENOTTY(_ error) bool { return false }
|
2022-11-11 14:53:42 +01:00
|
|
|
|
2015-08-16 12:39:38 +02:00
|
|
|
// We don't modify read-only on windows,
|
|
|
|
|
// since it will make us unable to delete the file,
|
|
|
|
|
// and this isn't common practice on this platform.
|
2025-02-28 19:52:43 +00:00
|
|
|
func setFileReadonly(_ string, _ os.FileMode) error {
|
2015-08-16 12:39:38 +02:00
|
|
|
return nil
|
|
|
|
|
}
|
2025-11-15 20:59:14 -05:00
|
|
|
|
|
|
|
|
func removeFile(f string) error {
|
|
|
|
|
// Reset read-only flag,
|
|
|
|
|
// as Windows won't let you delete a read-only file
|
|
|
|
|
err := os.Chmod(f, 0666)
|
|
|
|
|
if err != nil && !os.IsPermission(err) {
|
2025-11-19 07:09:24 +00:00
|
|
|
return errors.WithStack(err)
|
2025-11-15 20:59:14 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return os.Remove(f)
|
|
|
|
|
}
|