Compile on Swift 5.3
This commit is contained in:
@@ -60,7 +60,7 @@ If the file already exists and overwrite=false, the writing will begin at the en
|
||||
|
||||
- parameter overwrite: If true, replace the file if it exists.
|
||||
*/
|
||||
public func open(forWriting path: URL, overwrite: Bool = false, encoding: String.Encoding = main.encoding) throws -> WritableStream {
|
||||
public func open(forWriting path: URL, overwrite: Bool = false, encoding: String.Encoding = main.encoding) throws -> FileHandleStream {
|
||||
|
||||
if overwrite || !Files.fileExists(atPath: path.path) {
|
||||
try Files.createDirectory(at: path.deletingLastPathComponent(), withIntermediateDirectories: true, attributes: nil)
|
||||
@@ -83,7 +83,7 @@ If the file already exists and overwrite=false, the writing will begin at the en
|
||||
|
||||
- parameter overwrite: If true, replace the file if it exists.
|
||||
*/
|
||||
public func open(forWriting path: String, overwrite: Bool = false, encoding: String.Encoding = main.encoding) throws -> WritableStream {
|
||||
public func open(forWriting path: String, overwrite: Bool = false, encoding: String.Encoding = main.encoding) throws -> FileHandleStream {
|
||||
let fixedpath = path.hasPrefix("~") ? NSString(string: path).expandingTildeInPath : path
|
||||
return try open(forWriting: URL(fileURLWithPath: fixedpath, isDirectory: false), overwrite: overwrite, encoding: encoding)
|
||||
}
|
||||
|
||||
@@ -85,11 +85,6 @@ extension ReadableStream {
|
||||
while let text = self.readSome() { target.write(text) }
|
||||
}
|
||||
|
||||
/// Writes the text in this stream to the given WritableStream.
|
||||
public func write(to target: inout WritableStream) {
|
||||
while let text = self.readSome() { target.write(text) }
|
||||
}
|
||||
|
||||
#if !(os(iOS) || os(tvOS) || os(watchOS))
|
||||
public var context: Context {
|
||||
var context = CustomContext(main)
|
||||
|
||||
Reference in New Issue
Block a user