mirror of
https://github.com/geode-sdk/geode.git
synced 2024-12-18 11:52:24 -05:00
maybe mac fix 3
This commit is contained in:
parent
c494291ed7
commit
3ce86df1d6
1 changed files with 23 additions and 12 deletions
|
@ -162,22 +162,33 @@ 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>>;
|
||||||
[FileDialog dispatchFilePickerWithMode:mode options:options multiple:false onCompletion: ^(FileResult result) {
|
return RetTask::runWithCallback([mode, options](auto resultCallback, auto progress, auto cancelled) {
|
||||||
if (result.isOk()) {
|
[FileDialog dispatchFilePickerWithMode:mode options:options multiple:false onCompletion: ^(FileResult result) {
|
||||||
std::filesystem::path path = result.unwrap()[0];
|
if (cancelled()) {
|
||||||
return RetTask::immediate(Ok(path));
|
resultCallback(RetTask::Cancel());
|
||||||
} else {
|
} else {
|
||||||
return RetTask::immediate(Err(result.err().unwrap()));
|
if (result.isOk()) {
|
||||||
}
|
std::filesystem::path path = result.unwrap()[0];
|
||||||
}];
|
resultCallback(Ok(path));
|
||||||
|
} else {
|
||||||
|
resultCallback(Err(result.err().value()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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>>>;
|
||||||
[FileDialog dispatchFilePickerWithMode:mode options:options multiple:true onCompletion: ^(FileResult result) {
|
return RetTask::runWithCallback([options](auto resultCallback, auto progress, auto cancelled) {
|
||||||
return RetTask::immediate(result);
|
[FileDialog dispatchFilePickerWithMode:mode options:options multiple:true onCompletion: ^(FileResult result) {
|
||||||
}];
|
if (cancelled()) {
|
||||||
|
resultCallback(RetTask::Cancel());
|
||||||
|
} else {
|
||||||
|
resultCallback(result);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
CCPoint cocos::getMousePos() {
|
CCPoint cocos::getMousePos() {
|
||||||
|
|
Loading…
Reference in a new issue