mirror of
https://github.com/ow-mods/ow-mod-man.git
synced 2025-12-11 20:15:50 +01:00
[CORE] Edit fix_version to use trim_start_matches
This commit is contained in:
parent
447fc2a5f5
commit
dc9bd6bcb5
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -340,9 +340,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.2.0"
|
||||
version = "4.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6efb5f0a41b5ef5b50c5da28c07609c20091df0c1fc33d418fa2a7e693c2b624"
|
||||
checksum = "046ae530c528f252094e4a77886ee1374437744b2bff1497aa898bbddbbb29b3"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@ -351,9 +351,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.2.0"
|
||||
version = "4.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "671fcaa5debda4b9a84aa7fde49c907c8986c0e6ab927e04217c9cb74e7c8bc9"
|
||||
checksum = "223163f58c9a40c3b0a43e1c4b50a9ce09f007ea2cb1ec258a687945b4b7929f"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@ -2716,9 +2716,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.37.4"
|
||||
version = "0.37.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c348b5dc624ecee40108aa2922fed8bad89d7fcc2b9f8cb18f632898ac4a37f9"
|
||||
checksum = "0e78cc525325c06b4a7ff02db283472f3c042b7ff0c391f96c6d5ac6f4f91b75"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
|
||||
@ -16,11 +16,7 @@ use super::mods::{LocalMod, ModManifest, RemoteMod};
|
||||
use super::toggle::get_mod_enabled;
|
||||
|
||||
fn fix_version(version: &str) -> &str {
|
||||
let mut str = version;
|
||||
while str.starts_with('v') {
|
||||
str = str.strip_prefix('v').unwrap_or(str);
|
||||
}
|
||||
str
|
||||
version.trim_start_matches('v')
|
||||
}
|
||||
|
||||
/// Used internally to construct an actual [RemoteDatabase]
|
||||
|
||||
@ -81,7 +81,7 @@ pub struct LocalMod {
|
||||
pub manifest: ModManifest,
|
||||
}
|
||||
|
||||
/// Represent a mod that completely failed to load
|
||||
/// Represents a mod that completely failed to load
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Clone)]
|
||||
pub struct FailedMod {
|
||||
|
||||
@ -16,6 +16,7 @@ use crate::{
|
||||
/// Represents an error with a [LocalMod]
|
||||
#[typeshare]
|
||||
#[derive(Serialize, Clone)]
|
||||
#[serde(tag = "errorType", content = "payload")]
|
||||
pub enum ModValidationError {
|
||||
/// The mod's manifest was invalid, contains the error encountered when loading it
|
||||
InvalidManifest(String),
|
||||
|
||||
21
owmods_gui/frontend/src/types.d.ts
vendored
21
owmods_gui/frontend/src/types.d.ts
vendored
@ -46,11 +46,17 @@ export interface ModReadMe {
|
||||
/** Represents an installed mod */
|
||||
export interface LocalMod {
|
||||
enabled: boolean;
|
||||
errors: string[];
|
||||
errors: ModValidationError[];
|
||||
mod_path: string;
|
||||
manifest: ModManifest;
|
||||
}
|
||||
|
||||
/** Represents a mod that completely failed to load */
|
||||
export interface FailedMod {
|
||||
error: ModValidationError;
|
||||
mod_path: string;
|
||||
}
|
||||
|
||||
/** Represents a manifest file for a local mod. */
|
||||
export interface ModManifest {
|
||||
uniqueName: string;
|
||||
@ -119,6 +125,19 @@ export enum SocketMessageType {
|
||||
Debug = "debug"
|
||||
}
|
||||
|
||||
/** Represents an error with a [LocalMod] */
|
||||
export type ModValidationError =
|
||||
/** The mod's manifest was invalid, contains the error encountered when loading it */
|
||||
| { errorType: "InvalidManifest"; payload: string }
|
||||
/** The mod is missing a dependency that needs to be installed, contains the unique name of the missing dep */
|
||||
| { errorType: "MissingDep"; payload: string }
|
||||
/** A dependency of the mod is disabled, contains the unique name of the disabled dep */
|
||||
| { errorType: "DisabledDep"; payload: string }
|
||||
/** There's another enabled mod that conflicts with this one, contains the conflicting mod */
|
||||
| { errorType: "ConflictingMod"; payload: string }
|
||||
/** The DLL the mod specifies in its `manifest.json` doesn't exist, contains the path (if even present) to the DLL specified by the mod */
|
||||
| { errorType: "MissingDLL"; payload?: string };
|
||||
|
||||
export enum Theme {
|
||||
White = "White",
|
||||
Blue = "Blue",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user