Skip to content

Commit 8f810a5

Browse files
committed
Add conformance to CustomStringConvertible and replace name attribute with description
1 parent 1e1c305 commit 8f810a5

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Sources/SwiftDriver/Utilities/VirtualPath.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import TSCBasic
1313

1414
/// A virtual path.
15-
public enum VirtualPath: Hashable {
15+
public enum VirtualPath: Hashable, CustomStringConvertible {
1616
/// A relative path that has not been resolved based on the current working
1717
/// directory.
1818
case relative(RelativePath)
@@ -40,9 +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 {
43+
public var description: String {
4644
switch self {
4745
case .relative(let path):
4846
return path.pathString
@@ -153,9 +151,9 @@ extension VirtualPath {
153151
public func replacingExtension(with fileType: FileType) throws -> VirtualPath {
154152
let pathString: String
155153
if let ext = self.extension {
156-
pathString = String(name.dropLast(ext.count + 1))
154+
pathString = String(description.dropLast(ext.count + 1))
157155
} else {
158-
pathString = name
156+
pathString = description
159157
}
160158

161159
return try VirtualPath(path: pathString.appendingFileTypeExtension(fileType))

0 commit comments

Comments
 (0)