]> Cypherpunks repositories - gostls13.git/commit
path/filepath: add Localize
authorDamien Neil <dneil@google.com>
Sat, 30 Sep 2023 17:38:01 +0000 (10:38 -0700)
committerDamien Neil <dneil@google.com>
Mon, 26 Feb 2024 18:08:14 +0000 (18:08 +0000)
commite596e8831885ad057a7f1db1391fddfd53f06431
tree0e5893682f270732c95e823e3623c49ae87d98ec
parent7b583fd1a1aeda98daa5a9d485b35786c031e941
path/filepath: add Localize

Add the Localize function, which takes an io/fs slash-separated path
and returns an operating system path.

Localize returns an error if the path cannot be represented on
the current platform.

Replace internal/safefile.FromFS with Localize,
which serves the same purpose as this function.

The internal/safefile package remains separate from path/filepath
to avoid a dependency cycle with the os package.

Fixes #57151

Change-Id: I75c88047ddea17808276761da07bf79172c4f6fc
Reviewed-on: https://go-review.googlesource.com/c/go/+/531677
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
13 files changed:
api/next/57151.txt [new file with mode: 0644]
doc/next/6-stdlib/99-minor/path/filepath/57151.md [new file with mode: 0644]
src/internal/safefilepath/path.go
src/internal/safefilepath/path_other.go [deleted file]
src/internal/safefilepath/path_plan9.go [new file with mode: 0644]
src/internal/safefilepath/path_test.go [deleted file]
src/internal/safefilepath/path_unix.go [new file with mode: 0644]
src/internal/safefilepath/path_windows.go
src/net/http/fs.go
src/os/dir.go
src/os/file.go
src/path/filepath/path.go
src/path/filepath/path_test.go