Skip to content

Commit 4dd291e

Browse files
committed
Adjust file url for special tabs
1 parent 6c3d8d7 commit 4dd291e

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

Tool/Sources/XcodeInspector/XcodeWindowInspector.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public final class WorkspaceXcodeWindowInspector: XcodeWindowInspector {
9595
fileURLWithPath: path
9696
.replacingOccurrences(of: "file://", with: "")
9797
)
98-
return url
98+
return adjustFileURL(url)
9999
}
100100
return nil
101101
}
@@ -142,5 +142,14 @@ public final class WorkspaceXcodeWindowInspector: XcodeWindowInspector {
142142

143143
return lastGitDirectoryURL ?? firstDirectoryURL ?? workspaceURL
144144
}
145+
146+
static func adjustFileURL(_ url: URL) -> URL {
147+
if url.pathExtension == "playground",
148+
FileManager.default.fileIsDirectory(atPath: url.path)
149+
{
150+
return url.appendingPathComponent("Contents.swift")
151+
}
152+
return url
153+
}
145154
}
146155

0 commit comments

Comments
 (0)