Build the new FileSystem module for Android (#2660)

Motivation:

Get the new module building and tested on my Android CI again

Modifications:

- Add force unwraps where needed
- Update C types and account for nullability annotations in NDK 26
- Use /data/local/tmp for the `temporaryDirectory` and invoke it in the tests, instead of /tmp directly
- Don't copy over extended attributes
- Android doesn't support hard-linking on most partitions, so don't use it for materializing temporary files

Result:

Everything works again on Android
This commit is contained in:
finagolfin authored and GitHub committed 2024-03-05 14:46:54 +00:00
1 parent 63e8c4e1aa
commit 53be20532e
10 files changed
+44 -12

No files matched your search

+4
View File
@@ -625,6 +625,8 @@ public struct FileSystem: Sendable, FileSystemProtocol {
)
}.get()
}
#elseif os(Android)
return "/data/local/tmp"
#else
return "/tmp"
#endif
@@ -959,6 +961,7 @@ extension FileSystem {
permissions: info.permissions
)
#if !os(Android)
// Copy over extended attributes, if any exist.
do {
let attributes = try await dir.attributeNames()
@@ -979,6 +982,7 @@ extension FileSystem {
// that is the case.
()
}
#endif
// Build a list of directories to copy over. Do this after closing the current
// directory to avoid using too many descriptors.