mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
make file picker dialog cancellation not return an error but just cancel the task
This commit is contained in:
parent
766b71dfbd
commit
971e3fb254
1 changed files with 5 additions and 3 deletions
|
@ -123,11 +123,13 @@ Task<Result<std::filesystem::path>> file::pick(PickMode mode, FilePickOptions co
|
||||||
Result<std::filesystem::path> result;
|
Result<std::filesystem::path> result;
|
||||||
auto pickresult = nfdPick(nfdMode, options, &path);
|
auto pickresult = nfdPick(nfdMode, options, &path);
|
||||||
if (pickresult.isErr()) {
|
if (pickresult.isErr()) {
|
||||||
result = Err(pickresult.err().value());
|
if (pickresult.unwrapErr() == "Dialog cancelled") {
|
||||||
|
return RetTask::cancelled();
|
||||||
|
}
|
||||||
|
return RetTask::immediate(Err(pickresult.unwrapErr()));
|
||||||
} else {
|
} else {
|
||||||
result = Ok(path);
|
return RetTask::immediate(Ok(path));
|
||||||
}
|
}
|
||||||
return RetTask::immediate(std::move(result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Task<Result<std::vector<std::filesystem::path>>> file::pickMany(FilePickOptions const& options) {
|
Task<Result<std::vector<std::filesystem::path>>> file::pickMany(FilePickOptions const& options) {
|
||||||
|
|
Loading…
Reference in a new issue