Skip to content

Commit fe68e4e

Browse files
authored
Merge pull request #13 from vbergae/conform_virtualdevice_to_customstringconvertible
Conform VirtualPath to CustomStringConvertible
2 parents 1363342 + c8d4c7b commit fe68e4e

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

Sources/SwiftDriver/Utilities/VirtualPath.swift

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,7 @@ public enum VirtualPath: Hashable {
4040
}
4141

4242
/// The name of the path for presentation purposes.
43-
///
44-
/// FIXME: Maybe this should be debugDescription or description
45-
public var name: String {
46-
switch self {
47-
case .relative(let path):
48-
return path.pathString
49-
50-
case .absolute(let path):
51-
return path.pathString
52-
53-
case .standardInput, .standardOutput:
54-
return "-"
55-
56-
case .temporary(let path):
57-
return path.pathString
58-
}
59-
}
43+
public var name: String { description }
6044

6145
/// The extension of this path, for relative or absolute paths.
6246
public var `extension`: String? {
@@ -147,6 +131,24 @@ extension VirtualPath: Codable {
147131
}
148132
}
149133

134+
extension VirtualPath: CustomStringConvertible {
135+
public var description: String {
136+
switch self {
137+
case .relative(let path):
138+
return path.pathString
139+
140+
case .absolute(let path):
141+
return path.pathString
142+
143+
case .standardInput, .standardOutput:
144+
return "-"
145+
146+
case .temporary(let path):
147+
return path.pathString
148+
}
149+
}
150+
}
151+
150152
extension VirtualPath {
151153
/// Replace the extension of the given path with a new one based on the
152154
/// specified file type.

0 commit comments

Comments
 (0)