Commit 5ed350c 1 parent fb35c93 commit 5ed350c Copy full SHA for 5ed350c
File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -82,12 +82,20 @@ namespace updating
82
82
// prevent the warning that may show up depend on the value of the constants (#defines)
83
83
#pragma warning(push)
84
84
#pragma warning(disable : 4702)
85
+ #if USE_STD_EXPECTED
86
+ std::future<std::expected<github_version_info, std::wstring>> get_github_version_info_async (const bool prerelease)
87
+ #else
85
88
std::future<nonstd::expected<github_version_info, std::wstring>> get_github_version_info_async (const bool prerelease)
89
+ #endif
86
90
{
87
91
// If the current version starts with 0.0.*, it means we're on a local build from a farm and shouldn't check for updates.
88
92
if constexpr (VERSION_MAJOR == 0 && VERSION_MINOR == 0 )
89
93
{
94
+ #if USE_STD_EXPECTED
95
+ co_return std::unexpected (LOCAL_BUILD_ERROR);
96
+ #else
90
97
co_return nonstd::make_unexpected (LOCAL_BUILD_ERROR);
98
+ #endif
91
99
}
92
100
93
101
try
@@ -139,7 +147,11 @@ namespace updating
139
147
catch (...)
140
148
{
141
149
}
150
+ #if USE_STD_EXPECTED
151
+ co_return std::unexpected (NETWORK_ERROR);
152
+ #else
142
153
co_return nonstd::make_unexpected (NETWORK_ERROR);
154
+ #endif
143
155
}
144
156
#pragma warning(pop)
145
157
Original file line number Diff line number Diff line change 6
6
#include < filesystem>
7
7
#include < variant>
8
8
#include < winrt/Windows.Foundation.h>
9
+ // #if __MSVC_VERSION__ >= 1933 // MSVC begin to support std::unexpected in 19.33
10
+ #if __has_include(<expected> ) // use the same way with excepted-lite to detect std::unexcepted, as using it as backup
11
+ #include < expected>
12
+ #define USE_STD_EXPECTED 1
13
+ #else
9
14
#include < expected.hpp>
15
+ #define USE_STD_EXPECTED 0
16
+ #endif
10
17
11
18
#include < common/version/helper.h>
12
19
@@ -27,7 +34,11 @@ namespace updating
27
34
28
35
std::future<std::optional<std::filesystem::path>> download_new_version (const new_version_download_info& new_version);
29
36
std::filesystem::path get_pending_updates_path ();
37
+ #if USE_STD_EXPECTED
38
+ std::future<std::expected<github_version_info, std::wstring>> get_github_version_info_async (const bool prerelease = false );
39
+ #else
30
40
std::future<nonstd::expected<github_version_info, std::wstring>> get_github_version_info_async (const bool prerelease = false );
41
+ #endif
31
42
void cleanup_updates ();
32
43
33
44
// non-localized
You can’t perform that action at this time.
0 commit comments