go-embed-python icon indicating copy to clipboard operation
go-embed-python copied to clipboard

fix: make `CreateEmbeddedPipPackagesForKnownPlatforms` work with windows paths

Open Sutorenja opened this issue 11 months ago • 0 comments

This PR fixes #19

files.json (the file generated by doWriteFilesList()) stores platform-native paths to python packages. On Windows, the stored paths would be separated by backslashes, e.g. PIL\\BdfFontFile.py.

The stored paths are used directly by fs.ReadFile. fs.ReadFile is unconventional in that the paths MUST BE forward slashed regardless of the OS its ran on. From the io/fs docs:

Note that paths are slash-separated on all systems, even Windows. Paths containing other characters such as backslash and colon are accepted as valid, but those characters must never be interpreted by an FS implementation as path element separators

This PR converts the backslashes in the path to forward slashes right before calling fs.ReadFile. It does not change how the paths in files.json are stored.

Sutorenja avatar Feb 21 '25 11:02 Sutorenja