microsoft / go-winio

Win32 IO-related utilities for Go
MIT License
946 stars 180 forks source link

pkg/fs: Add RemoveAll function #261

Closed kevpar closed 10 months ago

kevpar commented 1 year ago

New RemoveAll function intended to be a replacement for os.RemoveAll usage and be tailored to Windows scenarios.

Most importantly, this function works with []uint16 instead of string. This allows it to properly delete Windows filesystem trees that contain files with invalid UTF-16 paths.

Signed-off-by: Kevin Parsons kevpar@microsoft.com

kevpar commented 1 year ago

I still want to determine if long path support is needed here. However the code should be reasonable to review as it exists already.

kevpar commented 1 year ago

Looks like some overzealous linter errors. May need to tune those down.

TBBle commented 1 year ago

For the record, Go 1.21 will obviate the need for this this by using WTF-8 to carry filenames on Windows, ensuring round-trip-safe string representation of the full range of valid Windows filenames.

kevpar commented 1 year ago

For the record, Go 1.21 will obviate the need for this this by using WTF-8 to carry filenames on Windows, ensuring round-trip-safe string representation of the full range of valid Windows filenames.

Yeah, I think it probably makes sense to just wait for go1.21 at this point. Glad that change made it in. :)