2022-03-28 20:23:47 +00:00
|
|
|
//go:build windows
|
2019-05-04 08:34:28 +00:00
|
|
|
// +build windows
|
|
|
|
|
|
|
|
package archiver
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
2024-11-03 15:01:59 +00:00
|
|
|
|
|
|
|
"github.com/restic/restic/internal/fs"
|
2019-05-04 08:34:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type wrappedFileInfo struct {
|
|
|
|
os.FileInfo
|
|
|
|
mode os.FileMode
|
|
|
|
}
|
|
|
|
|
|
|
|
func (fi wrappedFileInfo) Mode() os.FileMode {
|
|
|
|
return fi.mode
|
|
|
|
}
|
|
|
|
|
|
|
|
// wrapFileInfo returns a new os.FileInfo with the mode, owner, and group fields changed.
|
2024-11-03 15:01:59 +00:00
|
|
|
func wrapFileInfo(fi *fs.ExtendedFileInfo) *fs.ExtendedFileInfo {
|
2019-05-04 08:34:28 +00:00
|
|
|
// wrap the os.FileInfo and return the modified mode, uid and gid are ignored on Windows
|
2024-11-03 15:01:59 +00:00
|
|
|
return fs.ExtendedStat(wrappedFileInfo{
|
|
|
|
FileInfo: fi.FileInfo,
|
2019-05-05 12:57:38 +00:00
|
|
|
mode: mockFileInfoMode,
|
2024-11-03 15:01:59 +00:00
|
|
|
})
|
2019-05-04 08:34:28 +00:00
|
|
|
}
|
2024-09-14 16:59:59 +00:00
|
|
|
|
|
|
|
// wrapIrregularFileInfo returns a new os.FileInfo with the mode changed to irregular file
|
2024-11-03 15:01:59 +00:00
|
|
|
func wrapIrregularFileInfo(fi *fs.ExtendedFileInfo) *fs.ExtendedFileInfo {
|
|
|
|
return &fs.ExtendedFileInfo{
|
|
|
|
FileInfo: wrappedFileInfo{
|
|
|
|
FileInfo: fi.FileInfo,
|
|
|
|
mode: (fi.Mode() &^ os.ModeType) | os.ModeIrregular,
|
|
|
|
},
|
2024-09-14 16:59:59 +00:00
|
|
|
}
|
|
|
|
}
|