Yep. Drives me nuts when I see people fiddling with platform-specific path separators. Just use /, it works everywhere.
> - The path is limited to MAX_PATH (260 chars)
> - Unless you prefix the path with \\?\
> - However using \\?\ disables automatic conversion of / to \ in the path (and some other normalization)
See previous discussion[1]
[0] https://mastodon.gamedev.place/@AshleyGullen/111109299141510...
path = HOME / "cards" / f"{card_id}" / "card.yaml" path = f"{HOME}/cards/{card_id}/card.yaml"
Easier to read & write IMO, and works fine. Even on Windows. path = Path(“/foo”) / “a” / “b” / “c”
The following is functionally equivalent to the above: path = Path(“/foo”) / “a/b/c”
Which I really think was a mistake. The latter should resolve to “/foo/a\/b\/c” (IMO) because all other invalid characters (like space) are auto-escaped. What’s the point of the overloaded div operator otherwise?Even in modern versions of macOS, the GUI still allows you to create files and folders with slashes in their names; the slashes get recorded as colons in the filesystem.