File tree Expand file tree Collapse file tree
Core/Sources/HostApp/Benchmark Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ class LocalBenchmarkSettingsRepository: BenchmarkSettingsRepository {
55 private let localStorageManager : LocalStorageManager
66 private let benchmarkDirectoriesKey = " benchmarkDirectories "
77 private let benchmarkOutputDirectoryKey = " benchmarkOutputDirectory "
8- let projectRootURL : String = " /Users/christopherknapp/repos/ModernCleanArchitectureSwiftUI/ "
98
109 private var defaultOutputDirectory : URL {
1110 FileManager . default. homeDirectoryForCurrentUser
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ class RealtimeSuggestionControllerBenchmarkManager: BenchmarkManager {
5656 let xcodeWorkspaceFileURL = findXcodeWorkspace ( in: benchmarkDirectory) ,
5757 let workspace = try ? await workspacePool. fetchOrCreateWorkspace ( workspaceURL: xcodeWorkspaceFileURL)
5858 else { return nil }
59- let entrypoint = metadata. mapToEntrypoint ( prefixing: benchmarkSettingsRepository . projectRootURL )
59+ let entrypoint = metadata. mapToEntrypoint ( prefixing: benchmarkDirectory . path )
6060 let content : String = ( try ? String ( contentsOf: entrypoint. fileURL, encoding: . utf8) ) ?? " "
6161 let suggestionRequest = SuggestionProvider . SuggestionRequest (
6262 fileURL: entrypoint. fileURL,
@@ -212,12 +212,17 @@ struct MetadataDTO: Codable {
212212
213213extension MetadataDTO {
214214 func mapToEntrypoint( prefixing baseUrl: String ) -> EntryPoint {
215- EntryPoint (
215+ // Ensure there's exactly one "/" between the base and the filename
216+ let cleanedBase = baseUrl. hasSuffix ( " / " ) ? baseUrl : baseUrl + " / "
217+ let cleanedFilename = entrypoint. filename. hasPrefix ( " / " ) ? String ( entrypoint. filename. dropFirst ( ) ) : entrypoint. filename
218+ let fullPath = cleanedBase + cleanedFilename
219+
220+ return EntryPoint (
216221 cursor: CursorPosition (
217222 line: entrypoint. cursor. line,
218223 character: entrypoint. cursor. character
219224 ) ,
220- fileURL: URL ( fileURLWithPath: baseUrl + entrypoint . filename )
225+ fileURL: URL ( fileURLWithPath: fullPath )
221226 )
222227 }
223228}
Original file line number Diff line number Diff line change @@ -6,5 +6,4 @@ protocol BenchmarkSettingsRepository {
66 func saveBenchmarkDirectory( _ directory: BenchmarkDirectory ) throws
77 func deleteBenchmarkDirectory( _ directory: BenchmarkDirectory ) throws
88 func saveBenchmarkOutputDirectory( _ directory: String ) throws
9- var projectRootURL : String { get }
109}
You can’t perform that action at this time.
0 commit comments