atomic icon indicating copy to clipboard operation
atomic copied to clipboard

Handling long filenames on Windows

Open jkowalski opened this issue 4 years ago • 1 comments

It appears that long file names (longer than MAX_PATH which is 260 characters) passed to atomic.WriteFile are not automatically prefixed with \\?\ which makes them fail.

I have a workaround in my package: https://github.com/kopia/kopia/blob/59b0464931158fb0fdd436717788ee646327dd65/internal/atomicfile/atomicfile.go

Would it make sense to make similar change here?

jkowalski avatar Feb 10 '21 06:02 jkowalski

I actually don't think so. It's not really this package's responsibility to make sure that the caller's filename is correct. If the filename wouldn't work here, it wouldn't work with other os-related mechanisms either.

natefinch avatar Jun 27 '21 16:06 natefinch