Skip to content

Commit 38154b8

Browse files
committed
remove hardcoded test url
1 parent 0c9b3d8 commit 38154b8

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

Core/Sources/HostApp/Benchmark/Data/Repository/LocalBenchmarkSettingsRepository.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff 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

Core/Sources/HostApp/Benchmark/Domain/Manager/BenchmarkManager.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff 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

213213
extension 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
}

Core/Sources/HostApp/Benchmark/Domain/Repository/BenchmarkSettingsRepository.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)