mirror of
https://github.com/restic/restic.git
synced 2025-12-12 05:11:46 +00:00
fs / archiver: convert to handle based interface
The actual implementation still relies on file paths, but with the abstraction layer in place, an FS implementation can ensure atomic file accesses in the future.
This commit is contained in:
@@ -16,8 +16,8 @@ type Track struct {
|
||||
}
|
||||
|
||||
// OpenFile wraps the OpenFile method of the underlying file system.
|
||||
func (fs Track) OpenFile(name string, flag int) (File, error) {
|
||||
f, err := fs.FS.OpenFile(fixpath(name), flag)
|
||||
func (fs Track) OpenFile(name string, flag int, metadataOnly bool) (File, error) {
|
||||
f, err := fs.FS.OpenFile(name, flag, metadataOnly)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -31,7 +31,7 @@ type trackFile struct {
|
||||
|
||||
func newTrackFile(stack []byte, filename string, file File) *trackFile {
|
||||
f := &trackFile{file}
|
||||
runtime.SetFinalizer(f, func(_ *trackFile) {
|
||||
runtime.SetFinalizer(f, func(_ any) {
|
||||
fmt.Fprintf(os.Stderr, "file %s not closed\n\nStacktrack:\n%s\n", filename, stack)
|
||||
panic("file " + filename + " not closed")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user