mirror of
https://github.com/apple/swift-nio
synced 2026-11-30 05:28:44 +00:00
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:
1 parent
63e8c4e1aa
commit
53be20532e
10 files changed
+44
-12
No files matched your search
@@ -1116,16 +1116,22 @@ extension SystemFileHandle {
|
||||
if delayMaterialization {
|
||||
// When opening in this mode we can more "atomically" create the file, that is, by not
|
||||
// leaving the user with a half written file should e.g. the system crash or throw an
|
||||
// error while writing. On Linux we do this by opening the directory for the path
|
||||
// with `O_TMPFILE` and creating a hard link when closing the file. On other platforms
|
||||
// we generate a dot file with a randomised suffix name and rename it to the
|
||||
// error while writing. On non-Android Linux we do this by opening the directory for
|
||||
// the path with `O_TMPFILE` and creating a hard link when closing the file. On other
|
||||
// platforms we generate a dot file with a randomised suffix name and rename it to the
|
||||
// destination.
|
||||
#if os(Android)
|
||||
let temporaryHardLink = false
|
||||
#else
|
||||
let temporaryHardLink = true
|
||||
#endif
|
||||
return Self.syncOpenWithMaterialization(
|
||||
atPath: path,
|
||||
mode: mode,
|
||||
options: options,
|
||||
permissions: permissions,
|
||||
executor: executor
|
||||
executor: executor,
|
||||
useTemporaryFileIfPossible: temporaryHardLink
|
||||
)
|
||||
} else {
|
||||
return Self.syncOpen(
|
||||
|
||||
Reference in new issue
Block a user