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) => {
|
||||
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");
|
||||
match std::fs::create_dir_all(wbm_path.clone()) {
|
||||
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() {
|
||||
println!("Steam launch option is already set. Skipping.");
|
||||
return Ok(());
|
||||
|
@ -52,7 +56,7 @@ fn is_already_set() -> bool {
|
|||
// todo: improve logic
|
||||
// 1. find line only containing "750470"
|
||||
// 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
|
||||
// %command%
|
||||
|
|
|
@ -53,10 +53,6 @@ pub async fn install(game_path: String) -> Result<(), InstallErr> {
|
|||
|
||||
default_game_path
|
||||
} else {
|
||||
if !util::is_game_path_valid(&game_path) {
|
||||
return Err(InstallErr::GamePathNotValid);
|
||||
}
|
||||
|
||||
game_path
|
||||
};
|
||||
let game_path = game_path.as_str();
|
||||
|
|
|
@ -4,12 +4,10 @@
|
|||
pub enum InstallErr {
|
||||
UnsupportedOS,
|
||||
FailedToGetGamePath,
|
||||
GamePathNotValid,
|
||||
RemoveOldFilesFailed,
|
||||
BepInExDownloadFailed,
|
||||
BepInExUnzipFailed,
|
||||
WBMDownloadFailed,
|
||||
WBMRemoveFailed,
|
||||
WBMDirectoryCreationFailed,
|
||||
WBMUnzipFailed,
|
||||
LaunchOptionNotSet,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<div class="icon">
|
||||
<FaDownload />
|
||||
</div>
|
||||
<div>Install</div>
|
||||
<div>Install / Update</div>
|
||||
</a>
|
||||
|
||||
<a href={ROUTES.REMOVE}>
|
||||
|
@ -26,7 +26,7 @@
|
|||
@apply w-full flex justify-evenly;
|
||||
|
||||
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 {
|
||||
@apply w-full h-6 mb-2;
|
||||
|
|
|
@ -1,5 +1,72 @@
|
|||
<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>
|
||||
|
||||
<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 -->
|
||||
|
||||
<!-- On install complete -->
|
||||
<style lang="scss">
|
||||
@import "./styles/button.scss";
|
||||
|
||||
.install {
|
||||
@apply text-center;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -52,9 +52,13 @@
|
|||
{#if !wasButtonClicked}
|
||||
<!-- Hide after clicking the button -->
|
||||
{#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}
|
||||
<button on:click|once={() => remove()}>Remove!</button>
|
||||
<br />
|
||||
Remove WBM from your computer.
|
||||
{/if}
|
||||
{:else}
|
||||
<!-- Show only when the button is clicked -->
|
||||
|
|
|
@ -4,12 +4,10 @@
|
|||
export enum InstallErr {
|
||||
UnsupportedOS,
|
||||
FailedToGetGamePath,
|
||||
GamePathNotValid,
|
||||
RemoveOldFilesFailed,
|
||||
BepInExDownloadFailed,
|
||||
BepInExUnzipFailed,
|
||||
WBMDownloadFailed,
|
||||
WBMRemoveFailed,
|
||||
WBMDirectoryCreationFailed,
|
||||
WBMUnzipFailed,
|
||||
LaunchOptionNotSet,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue