Skip to content

Commit 75c4da6

Browse files
committed
fix bug where URL file strings could not be used to create a URL
1 parent 1abaeef commit 75c4da6

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

Core/Sources/HostApp/Benchmark/Data/Manager/MultiFileContextBenchmarkManager.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ class MultiFileContextBenchmarkManager: BenchmarkManager {
131131

132132
private func openFilespaces(entrypoint: EntryPoint, relevantSymbols: [SymbolContent], in workspace: Workspace) async {
133133
for symbol in relevantSymbols {
134-
if let filespace = try? await workspace.createFilespaceIfNeeded(fileURL: URL(fileURLWithPath: symbol.fileURL)) {
134+
if let fileURL = symbol.fileURL.toFileURL(),
135+
let filespace = try? await workspace.createFilespaceIfNeeded(fileURL: fileURL) {
135136
await workspace.didOpenFilespace(filespace)
136137
}
137138
}
@@ -142,7 +143,9 @@ class MultiFileContextBenchmarkManager: BenchmarkManager {
142143

143144
private func closeFilespaces(entrypoint: EntryPoint, relevantSymbols: [SymbolContent], in workspace: Workspace) async {
144145
for symbol in relevantSymbols {
145-
await workspace.didCloseFilespace(URL(fileURLWithPath: symbol.fileURL))
146+
if let fileURL = symbol.fileURL.toFileURL() {
147+
await workspace.didCloseFilespace(fileURL)
148+
}
146149
}
147150
await workspace.didCloseFilespace(entrypoint.fileURL)
148151
}
@@ -591,3 +594,9 @@ extension CodeEdit {
591594
)
592595
}
593596
}
597+
598+
extension String {
599+
func toFileURL() -> URL? {
600+
hasPrefix("file://") ? URL(string: self) : URL(fileURLWithPath: self)
601+
}
602+
}

0 commit comments

Comments
 (0)