update: fix sync-loop after the game is re-decompiled after an update (#135)

This commit is contained in:
Tyler Wilding 2022-08-08 21:08:21 -04:00 committed by GitHub
parent d20787ecc6
commit 360b92e81c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 22 deletions

20
src-tauri/Cargo.lock generated
View file

@ -53,16 +53,6 @@ version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc"
[[package]]
name = "app"
version = "1.0.1"
dependencies = [
"serde",
"serde_json",
"tauri",
"tauri-build",
]
[[package]]
name = "atk"
version = "0.15.1"
@ -1687,6 +1677,16 @@ dependencies = [
"windows-sys",
]
[[package]]
name = "opengoal-launcher"
version = "1.0.1"
dependencies = [
"serde",
"serde_json",
"tauri",
"tauri-build",
]
[[package]]
name = "openssl"
version = "0.10.40"

View file

@ -1,11 +1,11 @@
[package]
name = "app"
name = "opengoal-launcher"
version = "1.0.1" # APP_VERSION
description = "A Tauri App"
description = "A frontend for the OpenGOAL project"
authors = ["OpenGOAL"]
license = "ISC"
repository = "https://github.com/open-goal/launcher"
default-run = "app"
default-run = "opengoal-launcher"
edition = "2021"
rust-version = "1.61"

View file

@ -35,8 +35,15 @@
});
async function fullInstall() {
const installationSuccess = await fullInstallation(activeGame);
if (installationSuccess) {
const success = await fullInstallation(activeGame);
if (success) {
dispatch("change");
}
}
async function updateGame() {
const success = await recompileGame(activeGame);
if (success) {
dispatch("change");
}
}
@ -50,12 +57,7 @@
{:else}
{#if !$isInstalling}
{#if $gameNeedsReinstall}
<button
class="btn"
on:click={async () => await recompileGame(activeGame)}
>
Update Install
</button>
<button class="btn" on:click={updateGame}> Update Install </button>
{:else}
<button class="btn" on:click={fullInstall}> Setup </button>
{/if}

View file

@ -234,7 +234,7 @@ export async function fullInstallation(game: SupportedGame): Promise<boolean> {
}
}
export async function recompileGame(game: SupportedGame) {
export async function recompileGame(game: SupportedGame): Promise<boolean> {
const isoPath = await join(
await appDir(),
"data",
@ -252,6 +252,7 @@ export async function recompileGame(game: SupportedGame) {
await launcherConfig.setInstallStatus(game, true);
gameNeedsReinstall.update(() => false);
isInstalling.update(() => false);
return true;
} catch (err) {
installLog.error("unexpected error encountered", {
error: err,
@ -262,5 +263,6 @@ export async function recompileGame(game: SupportedGame) {
};
InstallStatus.update(() => errStatus);
isInstalling.update(() => false);
return false;
}
}