28 Commits

Author SHA1 Message Date
Jeremy Schonfeld
a57b06e39f
Remove _typeByName lookup of _FoundationNSNumberInitializer (#817) 2024-08-02 13:56:03 -07:00
Yuta Saito
c82d1673eb
Add WASI platform conditions for libc imports and word size (#776)
* 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.
2024-08-02 09:55:56 -07:00
Yuta Saito
e90b6c3f90
Skip sticky-bit check in isDeletableFile on WASI (#785)
WASI does not surface the sticky bit and getuid, so we cannot check
whether the file is actually deletable before attempting to delete it.
2024-08-01 09:30:17 -07:00
Yuta Saito
0b3974d351
Guard out user/group related code on WASI (#783)
* 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.
2024-08-01 09:23:13 -07:00
Yuta Saito
fab7195ea2
Guard out extended or fs attributes related code on WASI (#784)
This commit guards out the extended attributes and file system
attributes related code on WASI as WASI does not support these
features. Just return nothing or ignore the set request.
2024-08-01 09:20:05 -07:00
Jeremy Schonfeld
b4c77a35f9
Correctly set .fileTypeSymlink on windows (#773) 2024-07-26 13:14:19 -07:00
Jeremy Schonfeld
008613336a
Enable reading attributes of directory on Windows (#770) 2024-07-25 16:11:48 -07:00
Jeremy Schonfeld
196376b5fd
Use dynamic replacement instead of _typeByName for internationalization upcalls (#756)
* Use dynamic replacement instead of _typeByName for internationalization upcalls

* Make FOUNDATION_FRAMEWORK function non-dynamic

* Fix build failures
2024-07-23 14:43:01 -07:00
Jeremy Schonfeld
b58b05100c
Fully enable posixPermissions attribute on Windows (#733) 2024-07-15 12:25:35 -07:00
Jeremy Schonfeld
7f9238e35a
[Windows] Implement additional file attributes (#730)
* Implement additional windows file attributes

* Ensure GetFileInformationByHandle succeeds

Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>

* Correctly determine executability of file

* Simplify executable check

* Make .deviceIdentifier a future TODO

---------

Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
2024-07-12 13:38:57 -07:00
Saleem Abdulrasool
a7692238a8
FoundationEssentials: initial pass to add Android support (#704)
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.
2024-06-26 16:00:37 -07:00
Charles Hu
60506f3af4
Renamed _CShims to _FoundationCShims (#656)
Rationale: _CShims will effectivly become semi-public in the toolchain. We add the Foundation prefix to make it less generic.
2024-06-21 16:18:38 -07:00
Jeremy Schonfeld
7ee35fbeff
Add some WASI conditionals to FileManager (#681) 2024-06-17 13:56:14 -07:00
Saleem Abdulrasool
f89df9d5f3
FoundationEssentials: ensure that the path exists when stat'ing (#647)
On non-Windows targets we ensure that the path exists when we attempt to
query the attributes of the path. This adds the same check on Windows so
that we can have similar behaviour on all platforms.
2024-06-03 10:12:28 -07:00
Jeremy Schonfeld
3297fb33b4
Return file attributes as NSNumbers when SCL-F is imported (#641) 2024-05-29 14:06:38 -07:00
Saleem Abdulrasool
02e110faf6
FoundationEssentials: add type to the file attributes on Windows (#634)
Get the file type using the Win32 APIs and wire that into the attribute
dictionary.
2024-05-28 05:04:37 -07:00
Saleem Abdulrasool
4c26af5c20
FoundationEssentials: drop invalid modification dates (#628)
Follow the expected behaviour to drop invalid modification dates, e.g.
`+NaN`. This matches the semantics that are expected on Unix and avoids
a crash due to the initialiser.
2024-05-21 15:46:33 -07:00
Jeremy Schonfeld
db63ab39bb
(128078561) Fix FileManager bugs found by scl-f (#609) 2024-05-15 11:03:07 -07:00
Saleem Abdulrasool
b80fb683b6
FoundationEssentials: provide typed overloads for constants from WinSDK
This allows for us to use the constants without explicitly casting the
type to `DWORD` on each site of use. By providing the shadowing
overload we can simply use the constants without impacting the
readability of the surrounding code.
2024-04-11 15:53:31 -07:00
Saleem Abdulrasool
b2ba6f6f1c
FoundationEssentials: tweak FileManager utilities for Windows (#537)
Add a helper for time conversion and remove some functions which do not
make sense on Windows - users are not identified by integral IDs but
rather by SIDs. This helps reduce the error diagnostics when building
FoundationEssentials on Windows.
2024-04-10 16:37:03 -07:00
Saleem Abdulrasool
9491cce69c
FoundationEssentials: add some missing imports for Windows (#520)
This allows us to get further into building FoundationEssentials once
again on Windows. Much of the file system work has resulted in this
module no longer being viable on Windows and will need to be replaced to
allow building on Windows which does not have the `fts` APIs.
2024-03-29 14:19:23 -07:00
Jeremy Schonfeld
c1e5321e8d
(125120887) attributesForItem(atPath:) uses FileAttributeType instead of String for .type value 2024-03-21 15:51:16 -07:00
Jeremy Schonfeld
e9a621c6ef
(124077456) FileManager should not crash on malformed modificationDate attribute value 2024-03-13 10:44:59 -07:00
Jeremy Schonfeld
75f2ae99e4
(123713046) FileManager should always return values for immutable/appendOnly attributes
* (123713046) Ensure we always return values for immutable/appendOnly file attributes

* (123713046) Disable test on non-Darwin
2024-03-08 11:25:52 -08:00
Jeremy Schonfeld
e5211f2926
(122981400) Standardize on using internal import 2024-03-06 13:42:02 -08:00
Jeremy Schonfeld
f28d05ad9d
(122854809) Fix error handling for reading extended attributes 2024-02-13 18:55:36 -08:00
Jeremy Schonfeld
f99560eea6
(122800483) Add missing FOUNDATION_FRAMEWORK import for file protection classes 2024-02-12 10:37:52 -08:00
Jeremy Schonfeld
33856a556d
(120741818) Port FileManager to swift-foundation
* (120741818) Port FileManager to swift-foundation

* (120741818) Fix linux test failures

* (120741818) Fix build failures
2024-02-09 15:03:43 -08:00