diff --git a/loader/include/Geode/cocos/include/ccTypes.h b/loader/include/Geode/cocos/include/ccTypes.h index 107a460f7..0a3dfdfe3 100644 --- a/loader/include/Geode/cocos/include/ccTypes.h +++ b/loader/include/Geode/cocos/include/ccTypes.h @@ -28,7 +28,11 @@ THE SOFTWARE. #define __CCTYPES_H__ #include + +#ifdef __cplusplus #include +#endif + #include "../cocoa/CCGeometry.h" #include "../platform/CCGL.h" diff --git a/loader/src/platform/mac/util.mm b/loader/src/platform/mac/util.mm index ea863c9da..6fcd09944 100644 --- a/loader/src/platform/mac/util.mm +++ b/loader/src/platform/mac/util.mm @@ -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 @@ -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)); }); }