Skip to content

Commit

Permalink
annual camila314 commit: fix file picker on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
camila314 committed Jan 8, 2025
1 parent 203c819 commit 241be1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions loader/include/Geode/cocos/include/ccTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ THE SOFTWARE.
#define __CCTYPES_H__

#include <string>

#ifdef __cplusplus
#include <Geode/c++stl/gdstdlib.hpp>
#endif

#include "../cocoa/CCGeometry.h"
#include "../platform/CCGL.h"

Expand Down
5 changes: 3 additions & 2 deletions loader/src/platform/mac/util.mm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ @implementation FileDialog
// default path
if (options.defaultPath) {
auto defaultPath = [NSString stringWithUTF8String:options.defaultPath->c_str()];
[panel setDirectoryURL: [NSURL URLWithString: defaultPath]];
[panel setDirectoryURL: [NSURL fileURLWithPath: defaultPath]];
}

// other
Expand Down Expand Up @@ -153,8 +153,9 @@ @implementation FileDialog
}

+(void) dispatchFilePickerWithMode:(file::PickMode)mode options:(file::FilePickOptions const&)options multiple:(bool)mult onCompletion:(void(^)(FileResult&&))onCompletion {
file::FilePickOptions optionsCopy = options;
dispatch_async(dispatch_get_main_queue(), ^{
auto result = [self filePickerWithMode:mode options:options multiple:mult];
auto result = [self filePickerWithMode:mode options:optionsCopy multiple:mult];
onCompletion(std::move(result));
});
}
Expand Down

0 comments on commit 241be1b

Please sign in to comment.