Skip to content

Commit

Permalink
hiro/cocoa: Ensure trailing slash in directory picker result
Browse files Browse the repository at this point in the history
  • Loading branch information
jcm93 committed Feb 9, 2025
1 parent 1d5a5ae commit a1df24f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions hiro/cocoa/browser-window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ auto pBrowserWindow::directory(BrowserWindow::State& state) -> string {
if(state.title) [panel setTitle:[NSString stringWithUTF8String:state.title]];
panel.canChooseDirectories = YES;
panel.canChooseFiles = NO;
panel.canCreateDirectories = YES;
panel.directoryURL = [NSURL fileURLWithPath:[NSString stringWithUTF8String:state.path]];
if([panel runModal] == NSModalResponseOK) {
NSArray* files = [panel URLs];
const char* path = [[[files objectAtIndex:0] path] UTF8String];
if(path) result = path;
NSString* path = panel.URLs.firstObject.path;
path = [path stringByAppendingString:@"/"];
if(path) result = path.UTF8String;
}
}

Expand Down

0 comments on commit a1df24f

Please sign in to comment.