SE-0529: Add FilePath to the Standard Library

There was some discussion in the pitch thread about whether this type should offer some kind of withCString-like API for interacting with other APIs. I won't move the whole conversation over, but let me just repeat what I said there:

I think it's a great goal for Swift code to always be able to pass around local file paths as FilePaths. However, most path manipulation is ultimately in service of creating a path that can be passed off to some OS API, and if there's no standard way for arbitrary code to actually do that without writing its own copy-into-a-buffer code, that seems to undermine that goal rather than support it. Presumably we will eventually have a batteries-included local I/O library that just works with FilePath, but we don't have that now, and even when we do, it won't wrap every OS API that takes a path, much less every third-party C API. I think not having a convenient way to get a const char * / LPCWSTR / whatever out of this API would be a mistake.

6 Likes