File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
FileBrowserClient/FileBrowserClient Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ struct FileListView: View {
161161 . padding ( . trailing, 20 )
162162 . padding ( . bottom, 30 )
163163 }
164- . navigationTitle ( pathStack . last ? . components ( separatedBy : " / " ) . last ?? " Home " )
164+ . navigationTitle ( getNavigationTitle ( ) )
165165 . toolbar {
166166 // Left: Refresh button
167167 ToolbarItem ( placement: . navigationBarLeading) {
@@ -390,6 +390,23 @@ struct FileListView: View {
390390 )
391391 }
392392
393+ private func getNavigationTitle( ) -> String {
394+ // If we have a pathStack, use the last path component
395+ if let lastPath = pathStack. last, !lastPath. isEmpty {
396+ let components = lastPath. components ( separatedBy: " / " )
397+ return components. last ?? " Home "
398+ }
399+
400+ // If pathStack is empty or path is empty, we're at root
401+ if pathStack. isEmpty || path == " / " {
402+ return " Home "
403+ }
404+
405+ // Fallback: use the current path
406+ let components = path. components ( separatedBy: " / " )
407+ return components. last ?? " Home "
408+ }
409+
393410 func fetchClientStorageInfo( ) {
394411 fileCacheSize = FileCache . shared. diskCacheSize ( )
395412 }
You can’t perform that action at this time.
0 commit comments