install command update
- remove unnecessary checks (install_mod.rs and install/mod.rs) - removed unused InstallErrs - clearer frontend descriptions - implemented basic install feedback
This commit is contained in:
parent
466b72a3e0
commit
ac787b4dbc
9 changed files with 79 additions and 21 deletions
BIN
public/img/properties.png
Normal file
BIN
public/img/properties.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
|
@ -28,15 +28,6 @@ pub async fn install_wbm_mod(game_path: &str) -> Result<(), InstallErr> {
|
||||||
Ok(zip_path) => {
|
Ok(zip_path) => {
|
||||||
let wbm_path = std::path::Path::new(game_path).join("BepInEx/plugins/WBM");
|
let wbm_path = std::path::Path::new(game_path).join("BepInEx/plugins/WBM");
|
||||||
|
|
||||||
println!("Removing existing files");
|
|
||||||
match std::fs::remove_dir_all(wbm_path.clone()) {
|
|
||||||
Ok(_) => {}
|
|
||||||
Err(_) => {
|
|
||||||
println!("Failed to remove existing WBM mod files");
|
|
||||||
return Err(InstallErr::WBMRemoveFailed);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
println!("Creating WBM directory");
|
println!("Creating WBM directory");
|
||||||
match std::fs::create_dir_all(wbm_path.clone()) {
|
match std::fs::create_dir_all(wbm_path.clone()) {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
|
|
|
@ -19,6 +19,10 @@ pub async fn unix_launch_option_setup() -> Result<(), InstallErr> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// todo: make run_bepinex.sh executable
|
||||||
|
|
||||||
|
// todo: send launch option string to frontend
|
||||||
|
|
||||||
if is_already_set() {
|
if is_already_set() {
|
||||||
println!("Steam launch option is already set. Skipping.");
|
println!("Steam launch option is already set. Skipping.");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
@ -52,7 +56,7 @@ fn is_already_set() -> bool {
|
||||||
// todo: improve logic
|
// todo: improve logic
|
||||||
// 1. find line only containing "750470"
|
// 1. find line only containing "750470"
|
||||||
// 2. find next closest line only containing "}"
|
// 2. find next closest line only containing "}"
|
||||||
// 3. check if section contains "./run_bepinex.sh %command%"
|
// 3. check if section contains "run_bepinex.sh"
|
||||||
|
|
||||||
// run_bepinex.sh
|
// run_bepinex.sh
|
||||||
// %command%
|
// %command%
|
||||||
|
|
|
@ -53,10 +53,6 @@ pub async fn install(game_path: String) -> Result<(), InstallErr> {
|
||||||
|
|
||||||
default_game_path
|
default_game_path
|
||||||
} else {
|
} else {
|
||||||
if !util::is_game_path_valid(&game_path) {
|
|
||||||
return Err(InstallErr::GamePathNotValid);
|
|
||||||
}
|
|
||||||
|
|
||||||
game_path
|
game_path
|
||||||
};
|
};
|
||||||
let game_path = game_path.as_str();
|
let game_path = game_path.as_str();
|
||||||
|
|
|
@ -4,12 +4,10 @@
|
||||||
pub enum InstallErr {
|
pub enum InstallErr {
|
||||||
UnsupportedOS,
|
UnsupportedOS,
|
||||||
FailedToGetGamePath,
|
FailedToGetGamePath,
|
||||||
GamePathNotValid,
|
|
||||||
RemoveOldFilesFailed,
|
RemoveOldFilesFailed,
|
||||||
BepInExDownloadFailed,
|
BepInExDownloadFailed,
|
||||||
BepInExUnzipFailed,
|
BepInExUnzipFailed,
|
||||||
WBMDownloadFailed,
|
WBMDownloadFailed,
|
||||||
WBMRemoveFailed,
|
|
||||||
WBMDirectoryCreationFailed,
|
WBMDirectoryCreationFailed,
|
||||||
WBMUnzipFailed,
|
WBMUnzipFailed,
|
||||||
LaunchOptionNotSet,
|
LaunchOptionNotSet,
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<FaDownload />
|
<FaDownload />
|
||||||
</div>
|
</div>
|
||||||
<div>Install</div>
|
<div>Install / Update</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href={ROUTES.REMOVE}>
|
<a href={ROUTES.REMOVE}>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
@apply w-full flex justify-evenly;
|
@apply w-full flex justify-evenly;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
@apply p-4 w-24 h-24 text-center rounded-xl bg-red-500 text-white font-normal;
|
@apply p-3 w-24 h-24 text-center rounded-xl bg-red-500 text-white font-normal;
|
||||||
|
|
||||||
.icon {
|
.icon {
|
||||||
@apply w-full h-6 mb-2;
|
@apply w-full h-6 mb-2;
|
||||||
|
|
|
@ -1,5 +1,72 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import store from "./store"
|
||||||
|
import { InstallErr } from "./types"
|
||||||
|
import { install, selectGamePathAndRun } from "./logic"
|
||||||
|
|
||||||
|
let lastInstallErr: InstallErr = undefined
|
||||||
|
let wasInstallSuccessful: boolean = false
|
||||||
|
|
||||||
|
store.lastInstallErr.subscribe((value) => {
|
||||||
|
lastInstallErr = value
|
||||||
|
})
|
||||||
|
|
||||||
|
store.wasInstallSuccessful.subscribe((value) => {
|
||||||
|
wasInstallSuccessful = value
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div class="install">
|
||||||
|
{#if lastInstallErr == InstallErr.UnsupportedOS}
|
||||||
|
Operating System not supported.
|
||||||
|
<br />
|
||||||
|
WBM Installer is only available in Windows, Mac, and Linux.
|
||||||
|
{:else if lastInstallErr == InstallErr.FailedToGetGamePath}
|
||||||
|
Failed to find game folder.
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<button
|
||||||
|
on:click|once={() => {
|
||||||
|
selectGamePathAndRun(install)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Select game path
|
||||||
|
</button>
|
||||||
|
{:else if lastInstallErr == InstallErr.RemoveOldFilesFailed}
|
||||||
|
Failed to remove old files :(
|
||||||
|
{:else if lastInstallErr == InstallErr.BepInExDownloadFailed}
|
||||||
|
Failed to download BepInEx :(
|
||||||
|
{:else if lastInstallErr == InstallErr.BepInExUnzipFailed}
|
||||||
|
Failed to unzip BepInEx :(
|
||||||
|
{:else if lastInstallErr == InstallErr.WBMDownloadFailed}
|
||||||
|
Failed to download WBM :(
|
||||||
|
{:else if lastInstallErr == InstallErr.WBMDirectoryCreationFailed}
|
||||||
|
Failed to create WMB folder :(
|
||||||
|
{:else if lastInstallErr == InstallErr.WBMUnzipFailed}
|
||||||
|
Failed to unzip WBM :(
|
||||||
|
{:else if lastInstallErr == InstallErr.LaunchOptionNotSet}
|
||||||
|
<!-- todo: implement -->
|
||||||
|
Copy and paste the following text to ...
|
||||||
|
|
||||||
|
<img alt="where to find property settings" src="/img/properties.png" />
|
||||||
|
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
install()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Done! Continue!
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
<!-- Handle lastInstallErr change -->
|
<!-- Handle lastInstallErr change -->
|
||||||
|
|
||||||
<!-- On install complete -->
|
<!-- On install complete -->
|
||||||
|
<style lang="scss">
|
||||||
|
@import "./styles/button.scss";
|
||||||
|
|
||||||
|
.install {
|
||||||
|
@apply text-center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -52,9 +52,13 @@
|
||||||
{#if !wasButtonClicked}
|
{#if !wasButtonClicked}
|
||||||
<!-- Hide after clicking the button -->
|
<!-- Hide after clicking the button -->
|
||||||
{#if operationType == OperationType.Install}
|
{#if operationType == OperationType.Install}
|
||||||
<button on:click|once={() => install()}>Install/Update!</button>
|
<button on:click|once={() => install()}>Install / Update!</button>
|
||||||
|
<br />
|
||||||
|
Install the latest WBM.
|
||||||
{:else}
|
{:else}
|
||||||
<button on:click|once={() => remove()}>Remove!</button>
|
<button on:click|once={() => remove()}>Remove!</button>
|
||||||
|
<br />
|
||||||
|
Remove WBM from your computer.
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<!-- Show only when the button is clicked -->
|
<!-- Show only when the button is clicked -->
|
||||||
|
|
|
@ -4,12 +4,10 @@
|
||||||
export enum InstallErr {
|
export enum InstallErr {
|
||||||
UnsupportedOS,
|
UnsupportedOS,
|
||||||
FailedToGetGamePath,
|
FailedToGetGamePath,
|
||||||
GamePathNotValid,
|
|
||||||
RemoveOldFilesFailed,
|
RemoveOldFilesFailed,
|
||||||
BepInExDownloadFailed,
|
BepInExDownloadFailed,
|
||||||
BepInExUnzipFailed,
|
BepInExUnzipFailed,
|
||||||
WBMDownloadFailed,
|
WBMDownloadFailed,
|
||||||
WBMRemoveFailed,
|
|
||||||
WBMDirectoryCreationFailed,
|
WBMDirectoryCreationFailed,
|
||||||
WBMUnzipFailed,
|
WBMUnzipFailed,
|
||||||
LaunchOptionNotSet,
|
LaunchOptionNotSet,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue