some fixes

This commit is contained in:
2024-06-22 11:22:02 +02:00
parent 20c1e5dc8e
commit 4b78ce1b6f
3 changed files with 13 additions and 5 deletions

View File

@@ -41,7 +41,6 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
{ {
InstallInfos installInfos = null; InstallInfos installInfos = null;
UpdateInfos updateInfos = null; UpdateInfos updateInfos = null;
var hasConfig = modpackInfo.Exists;
var result = new UpdateCheckResult(); var result = new UpdateCheckResult();
if (updateConfig.Maintenance && !options.IgnoreMaintenance) if (updateConfig.Maintenance && !options.IgnoreMaintenance)
@@ -50,7 +49,13 @@ public class ModpackInstaller(ModpackConfig updateConfig, ModpackInfo modpackInf
return result; return result;
} }
if (!hasConfig) if (modpackInfo == null || !Directory.Exists(modpackInfo.LocaLPath))
{
result.HasError = true;
return result;
}
if (!modpackInfo.Exists)
{ {
installInfos = await DownloadInstallInfos(); installInfos = await DownloadInstallInfos();

View File

@@ -33,7 +33,10 @@ public class ModpackInfo
{ {
if (HasModpackInfo(mcRoot)) if (HasModpackInfo(mcRoot))
return Load(mcRoot); return Load(mcRoot);
return new(); return new()
{
LocaLPath = mcRoot
};
} }
public static ModpackInfo Load(string mcRoot) public static ModpackInfo Load(string mcRoot)

View File

@@ -10,7 +10,7 @@ namespace ModpackUpdater;
public partial class Form1 public partial class Form1
{ {
private ModpackInfo modpackInfo = null; private ModpackInfo modpackInfo = new();
private ModpackConfig updateConfig = new(); private ModpackConfig updateConfig = new();
private bool currentUpdating = false; private bool currentUpdating = false;
private UpdateCheckResult lastUpdateCheckResult = null; private UpdateCheckResult lastUpdateCheckResult = null;
@@ -94,7 +94,7 @@ public partial class Form1
{ {
RadTextBoxControl_MinecraftProfileFolder.Text = folderPath; RadTextBoxControl_MinecraftProfileFolder.Text = folderPath;
if (IsUpdateConfigLoaded()) if (IsMinecaftProfileLoaded())
{ {
try try
{ {