From 971e3fb2546df13cdc6d73c3cacd2f868789bc5e Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Sat, 24 Aug 2024 11:26:28 +0300 Subject: [PATCH] make file picker dialog cancellation not return an error but just cancel the task --- loader/src/platform/windows/util.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/loader/src/platform/windows/util.cpp b/loader/src/platform/windows/util.cpp index 984c4baf..b2a6e8b7 100644 --- a/loader/src/platform/windows/util.cpp +++ b/loader/src/platform/windows/util.cpp @@ -123,11 +123,13 @@ Task> file::pick(PickMode mode, FilePickOptions co Result 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>> file::pickMany(FilePickOptions const& options) {