make file picker dialog cancellation not return an error but just cancel the task

This commit is contained in:
HJfod 2024-08-24 11:26:28 +03:00
parent 766b71dfbd
commit 971e3fb254

View file

@ -123,11 +123,13 @@ Task<Result<std::filesystem::path>> file::pick(PickMode mode, FilePickOptions co
Result<std::filesystem::path> result;
auto pickresult = nfdPick(nfdMode, options, &path);
if (pickresult.isErr()) {
result = Err(pickresult.err().value());
if (pickresult.unwrapErr() == "Dialog cancelled") {
return RetTask::cancelled();
}
return RetTask::immediate(Err(pickresult.unwrapErr()));
} 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) {