Skip to content

Commit

Permalink
Replace custom fileURL property with URL(fileURLWithPath:)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnSundell committed Mar 20, 2017
1 parent fb2dec4 commit 81131c2
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Sources/Files.swift
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ public final class File: FileSystem.Item, FileSystemIterable {
*/
public func read() throws -> Data {
do {
return try Data(contentsOf: path.fileURL)
return try Data(contentsOf: URL(fileURLWithPath: path))
} catch {
throw Error.readFailed
}
Expand Down Expand Up @@ -438,7 +438,7 @@ public final class File: FileSystem.Item, FileSystemIterable {
*/
public func write(data: Data) throws {
do {
try data.write(to: path.fileURL)
try data.write(to: URL(fileURLWithPath: path))
} catch {
throw Error.writeFailed
}
Expand Down Expand Up @@ -862,10 +862,6 @@ private extension FileManager {
}

private extension String {
var fileURL: URL {
return URL(string: "file://" + self)!
}

var pathComponents: [String] {
return components(separatedBy: "/")
}
Expand Down

0 comments on commit 81131c2

Please sign in to comment.