main: Added better errors for git, node or npm not installed

This commit is contained in:
Nathan Woodburn 2023-06-13 11:30:54 +10:00
parent c7184be5ef
commit b93c981fcd
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
3 changed files with 103 additions and 4 deletions

View File

@ -12,7 +12,7 @@
<PackageIcon>HSDBatcher.png</PackageIcon> <PackageIcon>HSDBatcher.png</PackageIcon>
<RepositoryUrl>https://github.com/Nathanwoodburn/FireWallet</RepositoryUrl> <RepositoryUrl>https://github.com/Nathanwoodburn/FireWallet</RepositoryUrl>
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
<Version>2.4</Version> <Version>2.4.1</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -189,6 +189,13 @@ namespace FireWallet
Notifyinstall.CloseNotification(); Notifyinstall.CloseNotification();
Notifyinstall.Dispose(); Notifyinstall.Dispose();
} }
if (!Directory.Exists(dir + "hsd\\node_modules"))
{
AddLog("HSD install failed");
this.Close();
return false;
}
hsdProcess = new Process(); hsdProcess = new Process();
bool hideScreen = true; bool hideScreen = true;
@ -1315,6 +1322,72 @@ namespace FireWallet
} }
} }
// Check if git is installed
Process testInstalled = new Process();
testInstalled.StartInfo.FileName = "git";
testInstalled.StartInfo.Arguments = "-v";
testInstalled.StartInfo.RedirectStandardOutput = true;
testInstalled.StartInfo.UseShellExecute = false;
testInstalled.StartInfo.CreateNoWindow = true;
testInstalled.Start();
string outputInstalled = testInstalled.StandardOutput.ReadToEnd();
testInstalled.WaitForExit();
if (!outputInstalled.Contains("git version"))
{
AddLog("Git is not installed");
NotifyForm notifyForm = new NotifyForm("Git is not installed\nPlease install it to install HSD dependencies");
notifyForm.ShowDialog();
notifyForm.Dispose();
this.Close();
return;
}
// Check if node installed
testInstalled = new Process();
testInstalled.StartInfo.FileName = "node";
testInstalled.StartInfo.Arguments = "-v";
testInstalled.StartInfo.RedirectStandardOutput = true;
testInstalled.StartInfo.UseShellExecute = false;
testInstalled.StartInfo.CreateNoWindow = true;
testInstalled.Start();
outputInstalled = testInstalled.StandardOutput.ReadToEnd();
testInstalled.WaitForExit();
if (!outputInstalled.Contains("v"))
{
AddLog("Node is not installed");
NotifyForm notifyForm = new NotifyForm("Node is not installed\nPlease install it to install HSD dependencies");
notifyForm.ShowDialog();
notifyForm.Dispose();
this.Close();
return;
}
// Check if npm installed
testInstalled = new Process();
testInstalled.StartInfo.FileName = "npm";
testInstalled.StartInfo.Arguments = "-v";
testInstalled.StartInfo.RedirectStandardOutput = true;
testInstalled.StartInfo.UseShellExecute = false;
testInstalled.StartInfo.CreateNoWindow = true;
testInstalled.Start();
outputInstalled = testInstalled.StandardOutput.ReadToEnd();
testInstalled.WaitForExit();
if (outputInstalled.Length < 3)
{
AddLog("NPM is not installed");
NotifyForm notifyForm = new NotifyForm("NPM is not installed\nPlease install it to install HSD dependencies");
notifyForm.ShowDialog();
notifyForm.Dispose();
this.Close();
return;
}
ProcessStartInfo startInfo = new ProcessStartInfo(); ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "git"; startInfo.FileName = "git";
startInfo.Arguments = $"clone {repositoryUrl} {destinationPath}"; startInfo.Arguments = $"clone {repositoryUrl} {destinationPath}";
@ -1362,6 +1435,32 @@ namespace FireWallet
{ {
AddLog("Git/NPM Install FAILED"); AddLog("Git/NPM Install FAILED");
AddLog(ex.Message); AddLog(ex.Message);
if (ex.Message.Contains("to start process 'git'"))
{
NotifyForm notifyForm = new NotifyForm("Git needs to be installed\nCheck logs for more details");
notifyForm.ShowDialog();
notifyForm.Dispose();
}
else if (ex.Message.Contains("to start process 'node'"))
{
NotifyForm notifyForm = new NotifyForm("Node needs to be installed\nCheck logs for more details");
notifyForm.ShowDialog();
notifyForm.Dispose();
}
else if (ex.Message.Contains("to start process 'npm'"))
{
NotifyForm notifyForm = new NotifyForm("NPM needs to be installed\nCheck logs for more details");
notifyForm.ShowDialog();
notifyForm.Dispose();
}
else
{
NotifyForm notifyForm = new NotifyForm("Git/NPM Install FAILED\nCheck logs for more details");
notifyForm.ShowDialog();
notifyForm.Dispose();
}
this.Close();
} }
} }
public bool CheckNodeInstalled() public bool CheckNodeInstalled()

View File

@ -224,15 +224,15 @@
{ {
"Name" = "8:Microsoft Visual Studio" "Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:FireWallet" "ProductName" = "8:FireWallet"
"ProductCode" = "8:{24264791-86B1-49B5-88C9-5042C3FA1BF2}" "ProductCode" = "8:{139A6E5A-E5CE-4F8F-8A20-1E6357C7EBFE}"
"PackageCode" = "8:{8CC25786-EE60-4F7F-970E-D122B84DF8B5}" "PackageCode" = "8:{D71D73E3-BF4D-4E86-B932-E1244DEC1973}"
"UpgradeCode" = "8:{0C86F725-6B01-4173-AA05-3F0EDF481362}" "UpgradeCode" = "8:{0C86F725-6B01-4173-AA05-3F0EDF481362}"
"AspNetVersion" = "8:" "AspNetVersion" = "8:"
"RestartWWWService" = "11:FALSE" "RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE" "RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE" "InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:2.4" "ProductVersion" = "8:2.4.1"
"Manufacturer" = "8:Nathan.Woodburn/" "Manufacturer" = "8:Nathan.Woodburn/"
"ARPHELPTELEPHONE" = "8:" "ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:https://l.woodburn.au/discord" "ARPHELPLINK" = "8:https://l.woodburn.au/discord"