Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't throw error on WASM install when MSFS2024 isn't installed #1917

Merged
merged 2 commits into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions UI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using MobiFlight.InputConfig;
using Newtonsoft.Json;
using System.IO;
using FSUIPC;

namespace MobiFlight.UI
{
Expand Down Expand Up @@ -2253,12 +2254,20 @@ private void InstallWasmModule()

if (Is2020Different)
{
Update2020Successful = HandleWasmInstall(updater, Is2020Different, updater.CommunityFolder, "2020");
Update2020Successful = HandleWasmInstall(updater, updater.CommunityFolder, "2020");
}
else
{
Log.Instance.log($"WASM module for MSFS2020 is already up-to-date.", LogSeverity.Info);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this also be logged even if the user doesn't have 2020 installed?

}

if (Is2024Different)
{
Update2024Successful = HandleWasmInstall(updater, Is2024Different, updater.CommunityFolder2024, "2024");
Update2024Successful = HandleWasmInstall(updater, updater.CommunityFolder2024, "2024");
}
else
{
Log.Instance.log($"WASM module for MSFS2024 is already up-to-date.", LogSeverity.Info);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this also be logged even if the user doesn't have 2024 installed?

}

// If either update is successful then show the success dialog.
Expand Down Expand Up @@ -2287,22 +2296,15 @@ private void InstallWasmModule()
/// Handles all the necessary and log messages for installing the WASM with different versions of MSFS.
/// </summary>
/// <param name="updater">The WASM updater to use</param>
/// <param name="isDifferent">True if the versions of WASM were different</param>
/// <param name="communityFolder">The path to the community folder</param>
/// <param name="msfsVersion">The version of MSFS, either "2020" or "2024"</param>
/// <returns></returns>
private static bool HandleWasmInstall(WasmModuleUpdater updater, bool isDifferent, string communityFolder, string msfsVersion)
private static bool HandleWasmInstall(WasmModuleUpdater updater, string communityFolder, string msfsVersion)
{
if (String.IsNullOrEmpty(communityFolder))
{
Log.Instance.log($"Skipping WASM install for MSFS{msfsVersion} since no community folder was found. This likely means MSFS{msfsVersion} is not installed.", LogSeverity.Info);
return false;
}

if (!isDifferent)
{
Log.Instance.log($"WASM module for MSFS{msfsVersion} is already up-to-date.", LogSeverity.Info);
return false;
return true;
}

bool result = updater.InstallWasmModule(communityFolder);
Expand Down