Skip to content

Commit

Permalink
updating: require dotnet >=3.1.10 (#9060)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyoyuppe committed Jan 12, 2021
1 parent 9073ce8 commit 6ecf8b6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 12 deletions.
17 changes: 7 additions & 10 deletions .github/actions/spell-check/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ AGGREGATABLE
AHybrid
Aissue
akamaihd
alannt
ALarger
alekhyareddy
alertsolid
Expand Down Expand Up @@ -117,8 +116,8 @@ atlfile
atlstr
attr
Attribs
aumid
AUMID
aumid
AUTHN
AUTOAPPEND
autocomplete
Expand Down Expand Up @@ -222,6 +221,7 @@ CENTERALIGN
cfg
changecursor
Changemove
charconv
charset
chdir
checkbox
Expand Down Expand Up @@ -279,7 +279,6 @@ codeofconduct
codeql
codereview
COINIT
Colorbrush
colorconv
colorhistory
colorhistorylimit
Expand Down Expand Up @@ -467,8 +466,8 @@ DISPIDAMBIENTDLCONTROL
DISPINFO
Displayandhidethedesktop
DISPLAYCHANGE
displayname
DISPLAYNAME
displayname
divyan
DLACTIVEXCTLS
DLCONTROL
Expand Down Expand Up @@ -655,7 +654,7 @@ ERASEBKGND
EREOF
EResize
eriawan
ERRORLEVEL
errc
errorlevel
ERRORMESSAGE
ERRORTITLE
Expand Down Expand Up @@ -797,7 +796,6 @@ globalplugins
globals
gmx
google
gordonwatts
GPTR
grayscale
GText
Expand Down Expand Up @@ -857,8 +855,8 @@ HLSL
hmenu
hmodule
hmon
hmonitor
HMONITOR
hmonitor
HOLDENTER
HOLDESC
homljgmgpmcbpjbnjpfijnhipfkiclkd
Expand Down Expand Up @@ -1338,7 +1336,6 @@ modulekey
MONITORINFO
MONITORINFOEX
MONITORINFOEXW
MONITORINFOF
monitorinfof
Monthand
Moq
Expand Down Expand Up @@ -1803,6 +1800,7 @@ resw
resx
returnvalue
retval
rexit
rfind
rgb
RGBQUAD
Expand Down Expand Up @@ -2003,6 +2001,7 @@ sql
src
SRCCOPY
sre
sregex
SResize
srme
srre
Expand Down Expand Up @@ -2077,7 +2076,6 @@ SVGIn
svgpreviewhandler
svgr
SVGSVG
SWAPBUTTON
Switchbetweenvirtualdesktops
SWP
swprintf
Expand Down Expand Up @@ -2167,7 +2165,6 @@ toggleright
toggleswitch
toolbar
Toolchain
Toolset
toolset
tooltip
toolwindow
Expand Down
26 changes: 24 additions & 2 deletions src/common/updating/dotnet_installation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,30 @@ namespace updating
{
return false;
}
const char DESKTOP_DOTNET_RUNTIME_STRING[] = "Microsoft.WindowsDesktop.App 3.1.";
return runtimes->find(DESKTOP_DOTNET_RUNTIME_STRING) != std::string::npos;
constexpr size_t REQUIRED_MINIMAL_PATCH = 10;
std::regex dotnet3_1_x{ R"(Microsoft\.WindowsDesktop\.App\s3\.1\.(\d+))" };

size_t latestPatchInstalled = 0;
using rexit = std::sregex_iterator;
for (auto it = rexit{ begin(*runtimes), end(*runtimes), dotnet3_1_x }; it != rexit{}; ++it)
{
if (!it->ready() || it->size() < 2)
{
continue;
}
auto patchNumberGroup = (*it)[1];
if (!patchNumberGroup.matched)
{
continue;
}
const auto patchString = patchNumberGroup.str();
size_t patch = 0;
if (auto [_, ec] = std::from_chars(&*begin(patchString), &*end(patchString), patch); ec == std::errc())
{
latestPatchInstalled = std::max(patch, latestPatchInstalled);
}
}
return latestPatchInstalled >= REQUIRED_MINIMAL_PATCH;
}

std::optional<fs::path> download_dotnet()
Expand Down
3 changes: 3 additions & 0 deletions src/common/updating/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <winrt/base.h>
#pragma warning(default : 5205)
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>
#include <MsiQuery.h>
#include <Shlwapi.h>
Expand All @@ -19,6 +20,8 @@
#include <PathCch.h>

#include <optional>
#include <regex>
#include <charconv>

#include <expected.hpp>

Expand Down

0 comments on commit 6ecf8b6

Please sign in to comment.