diff --git a/supacode/Domain/ProjectWorkspace.swift b/supacode/Domain/ProjectWorkspace.swift index c33b3bd1..eda211fc 100644 --- a/supacode/Domain/ProjectWorkspace.swift +++ b/supacode/Domain/ProjectWorkspace.swift @@ -434,6 +434,10 @@ nonisolated struct ProjectWorkspace: Codable, Equatable, Hashable, Sendable { .appending(path: metadataFileName) } + static func hasMetadata(at rootURL: URL) -> Bool { + FileManager.default.fileExists(atPath: metadataURL(for: rootURL).path(percentEncoded: false)) + } + static func load(from rootURL: URL) -> ProjectWorkspace? { let metadataURL = metadataURL(for: rootURL) guard let data = try? Data(contentsOf: metadataURL) else { diff --git a/supacode/Features/Settings/BusinessLogic/RepositoryPersistenceKeys.swift b/supacode/Features/Settings/BusinessLogic/RepositoryPersistenceKeys.swift index 75bb222d..a90f67ee 100644 --- a/supacode/Features/Settings/BusinessLogic/RepositoryPersistenceKeys.swift +++ b/supacode/Features/Settings/BusinessLogic/RepositoryPersistenceKeys.swift @@ -205,7 +205,7 @@ nonisolated enum RepositoryEntryNormalizer { return order.compactMap { path in guard let kind = kindByPath[path] else { return nil } - if ProjectWorkspace.load(from: URL(fileURLWithPath: path)) != nil { + if ProjectWorkspace.hasMetadata(at: URL(fileURLWithPath: path)) { return PersistedRepositoryEntry(path: path, kind: .plain) } return PersistedRepositoryEntry(path: path, kind: kind)