Files
kopia/internal/atomicfile/atomicfile.go
Julio López 873a89a08d refactor(general): move SafeLongFilename to ospath (#5227)
- 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.
2026-03-17 17:43:08 -07:00

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)
}