forked from akanyan/STARTLINER
feat: more options
This commit is contained in:
@ -133,6 +133,17 @@ pub async fn get_current_profile(state: State<'_, Mutex<AppData>>) -> Result<Opt
|
||||
Ok(appd.profile.clone())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_current_profile_dir(state: State<'_, Mutex<AppData>>) -> Result<PathBuf, &str> {
|
||||
let appd = state.lock().await;
|
||||
|
||||
if let Some(p) = &appd.profile {
|
||||
Ok(p.dir())
|
||||
} else {
|
||||
Err("No profile loaded")
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn save_current_profile(state: State<'_, Mutex<AppData>>) -> Result<(), ()> {
|
||||
log::debug!("invoke: save_current_profile");
|
||||
@ -167,20 +178,6 @@ pub async fn init_profile(
|
||||
}
|
||||
}
|
||||
|
||||
// #[tauri::command]
|
||||
// pub async fn profile_dir(
|
||||
// state: State<'_, Mutex<AppData>>
|
||||
// ) -> Result<PathBuf, &str> {
|
||||
// let appd = state.lock().await;
|
||||
|
||||
// if let Some(p) = &appd.profile {
|
||||
// Ok(p.dir())
|
||||
// } else {
|
||||
// Err("No profile loaded")
|
||||
// }
|
||||
// }
|
||||
|
||||
// the tauri fs plugin doesn't fucking work
|
||||
#[tauri::command]
|
||||
pub async fn read_profile_data(
|
||||
state: State<'_, Mutex<AppData>>,
|
||||
|
@ -68,6 +68,7 @@ pub async fn run(_args: Vec<String>) {
|
||||
}
|
||||
}
|
||||
}))
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_deep_link::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
@ -106,6 +107,7 @@ pub async fn run(_args: Vec<String>) {
|
||||
cmd::init_profile,
|
||||
cmd::load_profile,
|
||||
cmd::get_current_profile,
|
||||
cmd::get_current_profile_dir,
|
||||
cmd::save_current_profile,
|
||||
cmd::read_profile_data,
|
||||
cmd::write_profile_data,
|
||||
|
@ -1,5 +1,5 @@
|
||||
use anyhow::{Result, anyhow};
|
||||
use std::{collections::{BTreeSet, HashMap}, path::{Path, PathBuf}};
|
||||
use std::{collections::{BTreeSet, BTreeMap}, path::{Path, PathBuf}};
|
||||
use crate::{model::misc::{self, Game}, pkg::PkgKey, util};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::fs;
|
||||
@ -20,7 +20,7 @@ pub struct ProfileData {
|
||||
pub wine_prefix: Option<PathBuf>,
|
||||
// cfg is temporarily just a map to make iteration easier
|
||||
// eventually it should become strict
|
||||
pub cfg: HashMap<String, serde_json::Value>
|
||||
pub cfg: BTreeMap<String, serde_json::Value>
|
||||
}
|
||||
|
||||
impl Profile {
|
||||
@ -43,7 +43,7 @@ impl Profile {
|
||||
mods: BTreeSet::new(),
|
||||
wine_runtime: None,
|
||||
wine_prefix: None,
|
||||
cfg: HashMap::new()
|
||||
cfg: BTreeMap::new()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user