* Add an upcall point to swift-corelibs-foundation for String encoding conversion
* Add upcall for conversion from bytes to String in non-swift-foundation encodings
* (133687793) Prevent buffer over-reads with string file system representations that fail
Signed-off-by: Jeremy Schonfeld <jschonfeld@apple.com>
* Account for empty buffers
Signed-off-by: Jeremy Schonfeld <jschonfeld@apple.com>
* Move empty buffer check earlier
Signed-off-by: Jeremy Schonfeld <jschonfeld@apple.com>
---------
Signed-off-by: Jeremy Schonfeld <jschonfeld@apple.com>
* Get FoundationEssentials building
Adding the missing musl imports to get FoundationEssentials building for
the Swift static SDKs again.
Also providing an option to disable building the macros. The macros
aren't necessary for building the library and will not be run as part of
the static SDK. No need to bloat the SDK or build times further. For
Swift 6, the macros should be provided by the toolchain since the
toolchain and SDK are current revlocked due to swiftmodules.
* Get FoundationInternationalization building
Adding the missing Musl imports to get FoundationInternationalization
building for the static SDK.
* [android] fix the LP32 armv7/i686 android build
* Update Sources/FoundationEssentials/Android+Extensions.swift
Co-authored-by: Jeremy Schonfeld <1004103+jmschonfeld@users.noreply.github.com>
* drop the android Lp32 specific operator &
---------
Co-authored-by: Jeremy Schonfeld <1004103+jmschonfeld@users.noreply.github.com>
* Add `import WASILibc` statements to libc import chains
* Declare wasm32 arch as 32-bit environment
* Switch to _pointerBitWidth for architecture checks
This change switches the architecture checks in Data.swift to use the
_pointerBitWidth instead of the arch() checks for consistency with newer
platforms.
* Guard out user/group related code on WASI
This change guards out the user/group related code on WASI, as WASI does
not have the concept of users or groups.
* Throw explicit unsupported error if trying to set user or group on WASI
Instead of implicitly ignoring user-given values, we should throw
exception to make it clear that those values cannot be set on WASI.
* Standardize backslashes before string path processing on Windows
* Call _standardizingSlashes() from normalizedPath(with:)
* Return self when possible on non-Windows
This adds the necessary guards and includes for the Android modules.
While the module does not compile currently due to nullability
differences (and in some cases missing declarations), this at least
brings the module to a point where we can start working on the errors
and differences to create a maintainable codebase for Android.
When trying to get the file system representation of a string, we may
have previously used `appendingPathComponent(_:)` which will have used
the incorrect separator. Ensure that all the separators are properly
converted prior to returning the path.
In the case that the path is canonicalised, the `/` would be replaced
with `\`. The leading `\` would interfere with our ability to recognise
the absolute path representation and thus get the wrong response.
* FoundationEssentials: correct path canonicalisation handling on Windows
Strip the extended path prefix for bypassing the Win32 API layer. This
is guaranteed to be prefixed on strings as per the documentation.
* Update Sources/FoundationEssentials/String/String+Path.swift
Co-authored-by: Jeremy Schonfeld <1004103+jmschonfeld@users.noreply.github.com>
---------
Co-authored-by: Jeremy Schonfeld <1004103+jmschonfeld@users.noreply.github.com>
When creating a file system representation from the path, we need to
strip the leading `/` which is added for the RFC representation of the
Windows path. Without this, the C runtime will fail with an invalid
argument error. Unfortunately this regresses the test suite by causing a
hang.