@@ -83,19 +83,11 @@ extension ContextMenuCoordinator {
8383
8484 // MARK: - Navigation
8585
86- /// Navigate panel to specified path
86+ /// Navigate panel to specified path (with retry + spinner for slow volumes)
8787 func navigateTo( _ url: URL , panel: PanelSide , appState: AppState ) {
8888 log. debug ( " \( #function) url=' \( url. path) ' panel= \( panel) " )
8989 Task { @MainActor in
90- appState. updatePath ( url. path, for: panel)
91- if panel == . left {
92- await appState. scanner. setLeftDirectory ( pathStr: url. path)
93- await appState. scanner. refreshFiles ( currSide: . left)
94- } else {
95- await appState. scanner. setRightDirectory ( pathStr: url. path)
96- await appState. scanner. refreshFiles ( currSide: . right)
97- }
98- log. debug ( " \( #function) navigation completed " )
90+ await appState. navigateToDirectory ( url. path, on: panel)
9991 }
10092 }
10193
@@ -116,25 +108,10 @@ extension ContextMenuCoordinator {
116108 return appState. focusedPanel
117109 }
118110
119- /// Create new folder in directory, then select it
111+ /// Show Create Folder dialog so the user can enter a name
120112 func performNewFolder( in directory: URL , appState: AppState ) {
121- log. debug ( " \( #function) directory=' \( directory. path) ' " )
122-
123- let baseName = " New Folder "
124- let newFolderURL = generateUniqueName ( baseName: baseName, in: directory, isDirectory: true )
125-
126- do {
127- try FileManager . default. createDirectory ( at: newFolderURL, withIntermediateDirectories: false )
128- let createdName = newFolderURL. lastPathComponent
129- let panel = panelForPath ( directory. path, appState: appState)
130- log. info ( " \( #function) SUCCESS created folder ' \( createdName) ' → selecting on \( panel) " )
131- Task { @MainActor in
132- await appState. refreshAndSelect ( name: createdName, on: panel)
133- }
134- } catch {
135- log. error ( " \( #function) FAILED: \( error. localizedDescription) " )
136- activeDialog = . error( title: " Create Folder Failed " , message: error. localizedDescription)
137- }
113+ log. debug ( " \( #function) showing dialog for directory=' \( directory. path) ' " )
114+ activeDialog = . createFolder( parentURL: directory)
138115 }
139116
140117 /// Create new empty file in directory, then select it
0 commit comments