[feat] read video config is ok
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use crate::steam;
|
||||
use crate::tool::*;
|
||||
use crate::vdf::preset;
|
||||
use crate::vdf::preset::VideoConfig;
|
||||
use crate::wrap_err;
|
||||
use anyhow::Result;
|
||||
|
||||
@@ -81,6 +82,31 @@ pub fn set_auto_login_user(user: &str) -> Result<String, String> {
|
||||
Ok(format!("Set auto login user to {}", user))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn get_cs2_video_config(steam_dir: &str, steam_id32: u32) -> Result<VideoConfig, String> {
|
||||
let p = format!(
|
||||
"{}/userdata/{}/730/local/cfg/cs2_video.txt",
|
||||
steam_dir, steam_id32
|
||||
);
|
||||
let video = preset::get_cs2_video(p.as_str()).map_err(|e| e.to_string())?;
|
||||
Ok(video)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn set_cs2_video_config(
|
||||
steam_dir: &str,
|
||||
steam_id32: u32,
|
||||
video_config: VideoConfig,
|
||||
) -> Result<(), String> {
|
||||
let p = format!(
|
||||
"{}/userdata/{}/730/local/cfg/cs2_video.txt",
|
||||
steam_dir, steam_id32
|
||||
);
|
||||
preset::set_cs2_video(p.as_str(), video_config).map_err(|e| e.to_string())?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn check_path(path: &str) -> Result<bool, String> {
|
||||
Ok(std::path::Path::new(&path).exists())
|
||||
|
||||
Reference in New Issue
Block a user