Skip to content

Commit ed46762

Browse files
committed
fixup
1 parent 30277bd commit ed46762

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

Sources/Basics/FileSystem+Extensions.swift

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import class Foundation.FileManager
1212
import struct Foundation.Data
1313
import TSCBasic
14-
import PackageDescription
1514

1615
// MARK: - user level
1716

@@ -22,7 +21,6 @@ extension FileSystem {
2221
}
2322
}
2423

25-
2624
// MARK: - cache
2725

2826
extension FileSystem {
@@ -119,18 +117,15 @@ extension FileSystem {
119117
public func readFileContents(_ path: AbsolutePath) throws -> Data {
120118
return try Data(self.readFileContents(path).contents)
121119
}
122-
120+
123121
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
122+
return try String(decoding: self.readFileContents(path), as: UTF8.self)
128123
}
129-
124+
130125
public func writeFileContents(_ path: AbsolutePath, data: Data) throws {
131126
return try self.writeFileContents(path, bytes: .init(data))
132127
}
133-
128+
134129
public func writeFileContents(_ path: AbsolutePath, string: String) throws {
135130
return try self.writeFileContents(path, bytes: .init(encodingAsUTF8: string))
136131
}

Sources/PackageGraph/PinsStore.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ fileprivate struct PinsStorage {
139139
partial[iterator.packageRef.identity] = iterator
140140
}
141141
default:
142-
throw StringError("unknown '\(Self.self)' version '\(version.version)' at '\(self.path)'.")
142+
throw StringError("unknown 'PinsStorage' version '\(version.version)' at '\(self.path)'.")
143143
}
144144
}
145145
}

Sources/SourceControl/RepositoryManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public class RepositoryManager {
170170
// Make sure destination is free.
171171
try? self.fileSystem.removeFileTree(repositoryPath)
172172
let isCached = self.cachePath.map{ self.fileSystem.exists($0.appending(handle.subpath)) } ?? false
173-
173+
174174
// Inform delegate.
175175
queue.async {
176176
let details = FetchDetails(fromCache: isCached, updatedCache: false)
@@ -469,7 +469,7 @@ fileprivate struct RepositoryManagerStorage {
469469
let v1 = try self.decoder.decode(path: self.path, fileSystem: self.fileSystem, as: V1.self)
470470
return try v1.object.repositories.mapValues{ try .init($0, manager: manager) }
471471
default:
472-
throw StringError("unknown '\(Self.self)' version '\(version.version)' at '\(self.path)'")
472+
throw StringError("unknown 'RepositoryManagerStorage' version '\(version.version)' at '\(self.path)'")
473473
}
474474
}
475475
}

Sources/Workspace/WorkspaceState.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fileprivate struct WorkspaceStateStorage {
9898
let artifacts = v4.object.artifacts.map{ Workspace.ManagedArtifact($0) }
9999
return (dependencies: .init(dependencyMap: dependencyMap), artifacts: .init(artifacts))
100100
default:
101-
throw StringError("unknown '\(Self.self)' version '\(version.version)' at '\(self.path)'")
101+
throw StringError("unknown 'WorkspaceStateStorage' version '\(version.version)' at '\(self.path)'")
102102
}
103103
}
104104
}

0 commit comments

Comments
 (0)