mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-22 15:37:53 -05:00
fix macos build
This commit is contained in:
parent
13b7cfc488
commit
5eda75311d
2 changed files with 12 additions and 7 deletions
|
@ -98,7 +98,12 @@ CFDataRef msgPortCallback(CFMessagePortRef port, SInt32 messageID, CFDataRef dat
|
||||||
|
|
||||||
std::string cdata(reinterpret_cast<char const*>(CFDataGetBytePtr(data)), CFDataGetLength(data));
|
std::string cdata(reinterpret_cast<char const*>(CFDataGetBytePtr(data)), CFDataGetLength(data));
|
||||||
|
|
||||||
std::string reply = geode::ipc::processRaw(port, cdata).dump();
|
auto res = geode::ipc::processRaw(port, cdata).dump();
|
||||||
|
if (!res) {
|
||||||
|
log::warn("Failed to process IPC message: {}", res.unwrapErr());
|
||||||
|
}
|
||||||
|
std::string reply = res.unwrapOr("");
|
||||||
|
|
||||||
return CFDataCreate(NULL, (UInt8 const*)reply.data(), reply.size());
|
return CFDataCreate(NULL, (UInt8 const*)reply.data(), reply.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace {
|
||||||
|
|
||||||
@interface FileDialog : NSObject
|
@interface FileDialog : NSObject
|
||||||
+(Result<std::vector<std::filesystem::path>>) filePickerWithMode:(file::PickMode)mode options:(file::FilePickOptions const&)options multiple:(bool)mult;
|
+(Result<std::vector<std::filesystem::path>>) filePickerWithMode:(file::PickMode)mode options:(file::FilePickOptions const&)options multiple:(bool)mult;
|
||||||
+(void) dispatchFilePickerWithMode:(file::PickMode)mode options:(file::FilePickOptions const&)options multiple:(bool)mult onCompletion:(void(^)(FileResult))onCompletion;
|
+(void) dispatchFilePickerWithMode:(file::PickMode)mode options:(file::FilePickOptions const&)options multiple:(bool)mult onCompletion:(void(^)(FileResult&&))onCompletion;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation FileDialog
|
@implementation FileDialog
|
||||||
|
@ -152,10 +152,10 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+(void) dispatchFilePickerWithMode:(file::PickMode)mode options:(file::FilePickOptions const&)options multiple:(bool)mult onCompletion:(void(^)(FileResult))onCompletion {
|
+(void) dispatchFilePickerWithMode:(file::PickMode)mode options:(file::FilePickOptions const&)options multiple:(bool)mult onCompletion:(void(^)(FileResult&&))onCompletion {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
auto result = [self filePickerWithMode:mode options:options multiple:mult];
|
auto result = [self filePickerWithMode:mode options:options multiple:mult];
|
||||||
onCompletion(result);
|
onCompletion(std::move(result));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ namespace {
|
||||||
GEODE_DLL Task<Result<std::filesystem::path>> file::pick(file::PickMode mode, file::FilePickOptions const& options) {
|
GEODE_DLL Task<Result<std::filesystem::path>> file::pick(file::PickMode mode, file::FilePickOptions const& options) {
|
||||||
using RetTask = Task<Result<std::filesystem::path>>;
|
using RetTask = Task<Result<std::filesystem::path>>;
|
||||||
return RetTask::runWithCallback([mode, options](auto resultCallback, auto progress, auto cancelled) {
|
return RetTask::runWithCallback([mode, options](auto resultCallback, auto progress, auto cancelled) {
|
||||||
[FileDialog dispatchFilePickerWithMode:mode options:options multiple:false onCompletion: ^(FileResult result) {
|
[FileDialog dispatchFilePickerWithMode:mode options:options multiple:false onCompletion: ^(FileResult&& result) {
|
||||||
if (cancelled()) {
|
if (cancelled()) {
|
||||||
resultCallback(RetTask::Cancel());
|
resultCallback(RetTask::Cancel());
|
||||||
} else {
|
} else {
|
||||||
|
@ -182,11 +182,11 @@ GEODE_DLL Task<Result<std::filesystem::path>> file::pick(file::PickMode mode, fi
|
||||||
GEODE_DLL Task<Result<std::vector<std::filesystem::path>>> file::pickMany(file::FilePickOptions const& options) {
|
GEODE_DLL Task<Result<std::vector<std::filesystem::path>>> file::pickMany(file::FilePickOptions const& options) {
|
||||||
using RetTask = Task<Result<std::vector<std::filesystem::path>>>;
|
using RetTask = Task<Result<std::vector<std::filesystem::path>>>;
|
||||||
return RetTask::runWithCallback([options](auto resultCallback, auto progress, auto cancelled) {
|
return RetTask::runWithCallback([options](auto resultCallback, auto progress, auto cancelled) {
|
||||||
[FileDialog dispatchFilePickerWithMode: file::PickMode::OpenFile options:options multiple:true onCompletion: ^(FileResult result) {
|
[FileDialog dispatchFilePickerWithMode: file::PickMode::OpenFile options:options multiple:true onCompletion: ^(FileResult&& result) {
|
||||||
if (cancelled()) {
|
if (cancelled()) {
|
||||||
resultCallback(RetTask::Cancel());
|
resultCallback(RetTask::Cancel());
|
||||||
} else {
|
} else {
|
||||||
resultCallback(result);
|
resultCallback(std::move(result));
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue