Ensure that FilePath and SystemString's invariants are enforced when decoding.
Cherry-pick of merge-commit 9c42c54644
from PR #189
# Conflicts:
# Sources/System/FilePath/FilePath.swift
Availability annotations now follow a rigid syntax that mentions the swift-system version that introduced the entry point:
```
/*System 0.0.2, @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)*/
public func greeting() -> String {
"Hello"
}
```
This is designed to be processed by automated source generation tools.
CSystem is a leaky library dependency from System and must be
distributed. Install the files and make the dependency public so that
it is emitted into the clients.
Update cmake setup so that the library can be used by SwiftPM cmake build
Motivation: integrate with SwiftPM
changes:
* rename the top level project to SwiftSystem instead of swift-system to align with other projects
* rename System to SystemPackage to align with SwifPM setup
* update architectures to include arm64
* Update cmake/modules/SwiftSystemConfig.cmake.in
* Update cmake/modules/SwiftSupport.cmake
- Adds a `directory` OpenOptions as a type-safe version of O_DIRECTORY.
Allows clients to only open a FileDescriptor for FilePaths that refer
to directories.
Un-deprecate withCString, but make sure it's not available on Windows (because
the types will not match). withPlatformString is still the preferred
expression of this and favors more portable code.
When building on Windows, we rely on the `withPlatformString` to convert
the strings to the native platform encoding (UTF-16). The public
`FilePath.withPlatformString` is marked as `@_alwaysEmitIntoClient` and
references the `_withPlatformString` which is marked as `internal`.
Annotate the function as `@usableFromInline` to enable the inlined
method to reference this function.
Windows does not have the same set of error codes as a POSIX system.
However, the WinSock subsystem provides a set of error codes which are
meant to provide a means for handling similar error scenarios with
sockets. This additionally adds an additional error code which allows
us to add back a previously ignored error code.