We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0d0e4db commit 7e28c6bCopy full SHA for 7e28c6b
Sources/Basics/FileSystem+Extensions.swift
@@ -11,7 +11,6 @@
11
import class Foundation.FileManager
12
import struct Foundation.Data
13
import TSCBasic
14
-import PackageDescription
15
16
// MARK: - user level
17
@@ -121,10 +120,7 @@ extension FileSystem {
121
120
}
122
123
public func readFileContents(_ path: AbsolutePath) throws -> String {
124
- guard let string = try String(data: self.readFileContents(path), encoding: .utf8) else {
125
- throw StringError("invalid UTF8 string")
126
- }
127
- return string
+ return try String(decoding: self.readFileContents(path), as: UTF8.self)
128
129
130
public func writeFileContents(_ path: AbsolutePath, data: Data) throws {
0 commit comments