@@ -46,7 +46,8 @@ IPyRunner pyRunner
4646
4747 private DirectoryPath DotnetDir => AssetsDir . JoinDir ( "dotnet" ) ;
4848 private string DotnetPath => Path . Combine ( DotnetDir , "dotnet" ) ;
49- private bool IsDotnetInstalled => File . Exists ( DotnetPath ) ;
49+ private string Dotnet7SdkExistsPath => Path . Combine ( DotnetDir , "sdk" , "7.0.405" ) ;
50+ private string Dotnet8SdkExistsPath => Path . Combine ( DotnetDir , "sdk" , "8.0.101" ) ;
5051 private string Dotnet7DownloadUrlMacOs =>
5152 "https://download.visualstudio.microsoft.com/download/pr/5bb0e0e4-2a8d-4aba-88ad-232e1f65c281/ee6d35f762d81965b4cf336edde1b318/dotnet-sdk-7.0.405-osx-arm64.tar.gz" ;
5253 private string Dotnet8DownloadUrlMacOs =>
@@ -103,19 +104,17 @@ public async Task InstallPackageRequirements(
103104
104105 public async Task InstallDotnetIfNecessary ( IProgress < ProgressReport > ? progress = null )
105106 {
106- if ( IsDotnetInstalled )
107- return ;
107+ var downloadUrl = Compat . IsMacOS ? Dotnet8DownloadUrlMacOs : Dotnet8DownloadUrlLinux ;
108108
109- if ( Compat . IsMacOS )
110- {
111- await DownloadAndExtractPrerequisite ( progress , Dotnet7DownloadUrlMacOs , DotnetDir ) ;
112- await DownloadAndExtractPrerequisite ( progress , Dotnet8DownloadUrlMacOs , DotnetDir ) ;
113- }
114- else
109+ var dotnet8SdkExists = Directory . Exists ( Dotnet8SdkExistsPath ) ;
110+
111+ if ( dotnet8SdkExists && Directory . Exists ( DotnetDir ) )
115112 {
116- await DownloadAndExtractPrerequisite ( progress , Dotnet7DownloadUrlLinux , DotnetDir ) ;
117- await DownloadAndExtractPrerequisite ( progress , Dotnet8DownloadUrlLinux , DotnetDir ) ;
113+ Logger . Info ( "Dotnet 8 SDK already installed at {DotnetDir}" , DotnetDir ) ;
114+ return ;
118115 }
116+
117+ await DownloadAndExtractPrerequisite ( progress , downloadUrl , DotnetDir ) ;
119118 }
120119
121120 private async Task InstallVirtualenvIfNecessary ( IProgress < ProgressReport > ? progress = null )
@@ -149,7 +148,7 @@ public async Task InstallAllIfNecessary(IProgress<ProgressReport>? progress = nu
149148 public async Task UnpackResourcesIfNecessary ( IProgress < ProgressReport > ? progress = null )
150149 {
151150 // Array of (asset_uri, extract_to)
152- var assets = new [ ] { ( Assets . SevenZipExecutable , AssetsDir ) , ( Assets . SevenZipLicense , AssetsDir ) , } ;
151+ var assets = new [ ] { ( Assets . SevenZipExecutable , AssetsDir ) , ( Assets . SevenZipLicense , AssetsDir ) } ;
153152
154153 progress ? . Report ( new ProgressReport ( 0 , message : "Unpacking resources" , isIndeterminate : true ) ) ;
155154
@@ -177,10 +176,10 @@ public async Task InstallGitIfNecessary(IProgress<ProgressReport>? progress = nu
177176 {
178177 new TextBlock
179178 {
180- Text = "The current operation requires Git. Please install it to continue."
179+ Text = "The current operation requires Git. Please install it to continue." ,
181180 } ,
182181 new SelectableTextBlock { Text = "$ sudo apt install git" } ,
183- }
182+ } ,
184183 } ,
185184 PrimaryButtonText = Resources . Action_Retry ,
186185 CloseButtonText = Resources . Action_Close ,
@@ -352,6 +351,22 @@ public async Task RunNpm(
352351 ) ;
353352 }
354353
354+ // NOTE TO FUTURE DEVS: if this is causing merge conflicts with dev, just nuke it we don't need anymore
355+ private async Task < string > RunNode (
356+ ProcessArgs args ,
357+ string ? workingDirectory = null ,
358+ IReadOnlyDictionary < string , string > ? envVars = null
359+ )
360+ {
361+ var nodePath = Path . Combine ( NodeDir , "bin" , "node" ) ;
362+ var result = await ProcessRunner
363+ . GetProcessResultAsync ( nodePath , args , workingDirectory , envVars )
364+ . ConfigureAwait ( false ) ;
365+
366+ result . EnsureSuccessExitCode ( ) ;
367+ return result . StandardOutput ?? result . StandardError ?? string . Empty ;
368+ }
369+
355370 [ SupportedOSPlatform ( "Linux" ) ]
356371 [ SupportedOSPlatform ( "macOS" ) ]
357372 public async Task < Process > RunDotnet (
@@ -396,17 +411,32 @@ public async Task<Process> RunDotnet(
396411 [ SupportedOSPlatform ( "macOS" ) ]
397412 public async Task InstallNodeIfNecessary ( IProgress < ProgressReport > ? progress = null )
398413 {
399- if ( IsNodeInstalled )
414+ // NOTE TO FUTURE DEVS: if this is causing merge conflicts with dev, just nuke it we don't need anymore
415+ if ( NodeDir . Exists )
400416 {
401- Logger . Info ( "node already installed" ) ;
402- return ;
417+ try
418+ {
419+ var result = await RunNode ( "-v" ) ;
420+ if ( result . Contains ( "20.19.3" ) )
421+ {
422+ Logger . Debug ( "Node.js already installed at {NodeExistsPath}" , NodeDir ) ;
423+ return ;
424+ }
425+ }
426+ catch ( Exception )
427+ {
428+ // ignored
429+ }
430+
431+ Logger . Warn ( "Node.js version mismatch, reinstalling..." ) ;
432+ await NodeDir . DeleteAsync ( true ) ;
403433 }
404434
405435 Logger . Info ( "Downloading node" ) ;
406436
407437 var downloadUrl = Compat . IsMacOS
408- ? "https://nodejs.org/dist/v20.11.0 /node-v20.11.0 -darwin-arm64.tar.gz"
409- : "https://nodejs.org/dist/v20.11.0 /node-v20.11.0 -linux-x64.tar.gz" ;
438+ ? "https://nodejs.org/dist/v20.19.3 /node-v20.19.3 -darwin-arm64.tar.gz"
439+ : "https://nodejs.org/dist/v20.19.3 /node-v20.19.3 -linux-x64.tar.gz" ;
410440
411441 var nodeDownloadPath = AssetsDir . JoinFile ( Path . GetFileName ( downloadUrl ) ) ;
412442
@@ -426,8 +456,8 @@ public async Task InstallNodeIfNecessary(IProgress<ProgressReport>? progress = n
426456 await ArchiveHelper . Extract7ZAuto ( nodeDownloadPath , AssetsDir ) ;
427457
428458 var nodeDir = Compat . IsMacOS
429- ? AssetsDir . JoinDir ( "node-v20.11.0 -darwin-arm64" )
430- : AssetsDir . JoinDir ( "node-v20.11.0 -linux-x64" ) ;
459+ ? AssetsDir . JoinDir ( "node-v20.19.3 -darwin-arm64" )
460+ : AssetsDir . JoinDir ( "node-v20.19.3 -linux-x64" ) ;
431461 Directory . Move ( nodeDir , NodeDir ) ;
432462
433463 progress ? . Report (
0 commit comments