mirror of
https://github.com/kopia/kopia.git
synced 2026-03-26 18:11:45 -04:00
- Move MaybePrefixLongFilenameOnWindows to ospath package and rename it to SafeLongFilename, along with corresponding test. - Elide the function implementation at build time on non-Windows platforms. - Update documentation and comments for clarity. - Rename package-local helper function.
17 lines
447 B
Go
17 lines
447 B
Go
// Package atomicfile provides wrappers for atomically writing files in a manner compatible with long filenames.
|
|
package atomicfile
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/natefinch/atomic"
|
|
|
|
"github.com/kopia/kopia/internal/ospath"
|
|
)
|
|
|
|
// Write is a wrapper around atomic.WriteFile that handles long file names on Windows.
|
|
func Write(filename string, r io.Reader) error {
|
|
//nolint:wrapcheck
|
|
return atomic.WriteFile(ospath.SafeLongFilename(filename), r)
|
|
}
|