Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Emit withPlatformString as an availability workaround for open
  • Loading branch information
milseman committed Mar 15, 2021
commit b5a4522966d8e642892ae1daa4ce144939d76a40
7 changes: 6 additions & 1 deletion Sources/System/FilePath/FilePathString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,15 @@ extension FilePath {
/// The pointer passed as an argument to `body` is valid
/// only during the execution of this method.
/// Don't try to store the pointer for later use.
@_alwaysEmitIntoClient
public func withPlatformString<Result>(
_ body: (UnsafePointer<CInterop.PlatformChar>) throws -> Result
) rethrows -> Result {
#if !os(Windows)
try withCString(body)
#else
try _withPlatformString(body)
#endif
}
}

Expand Down Expand Up @@ -412,7 +417,7 @@ extension FilePath {
#if os(Windows)
fatalError("FilePath.withCString() unsupported on Windows ")
#else
return try withPlatformString(body)
return try _withPlatformString(body)
#endif
}
}