Skip to content

Commit a435345

Browse files
committed
Fix breadcrumb display having folders with same name
1 parent 0516eb1 commit a435345

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

CodeEdit/Breadcrumbs/BreadcrumbsView.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,14 @@ struct BreadcrumbsView: View {
6565
}
6666

6767
private func fileInfo(_ file: WorkspaceClient.FileItem) {
68-
guard let projName = workspace.fileURL?.lastPathComponent,
69-
var components = file.url.pathComponents.split(separator: projName).last else { return }
70-
components.removeLast()
68+
guard let projURL = workspace.fileURL else { return }
69+
let components = file.url.path
70+
.replacingOccurrences(of: projURL.path, with: "")
71+
.split(separator: "/")
72+
.map { String($0) }
73+
.dropLast()
7174

72-
self.projectName = projName
75+
self.projectName = projURL.lastPathComponent
7376
self.folders = Array(components)
7477
self.fileName = file.fileName
7578
self.fileImage = file.systemImage

0 commit comments

Comments
 (0)