[dep] adapt tauri dep
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_autostart::MacosLauncher;
|
||||
use tauri_plugin_cli::CliExt;
|
||||
// use tauri_plugin_deep_link::DeepLinkExt;
|
||||
use tauri_plugin_deep_link::DeepLinkExt;
|
||||
use tauri_plugin_store::StoreExt;
|
||||
|
||||
// Window Vibrancy
|
||||
|
||||
@@ -14,11 +14,9 @@ pub fn get_steam_users() -> Result<String, String> {
|
||||
}
|
||||
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_get_steam_users() {
|
||||
let result = get_steam_users();
|
||||
let result = super::get_steam_users();
|
||||
assert!(result.is_ok() || result.is_err());
|
||||
println!("{}", result.unwrap());
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ pub fn get_exe_path(name: &str) -> Result<String, std::io::Error> {
|
||||
pub fn open_path(path: &str) -> Result<(), std::io::Error> {
|
||||
// path中所有/ 转换为 \
|
||||
let path = path.replace("/", "\\");
|
||||
fs::create_dir_all(path)?;
|
||||
fs::create_dir_all(&path)?;
|
||||
|
||||
#[cfg(windows)]
|
||||
Command::new("cmd.exe")
|
||||
@@ -82,27 +82,26 @@ pub fn open_path(path: &str) -> Result<(), std::io::Error> {
|
||||
}
|
||||
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn test_open_path() {
|
||||
let path = "D:\\Programs\\Steam";
|
||||
println!("test open path: {}", path);
|
||||
open_path(path).unwrap();
|
||||
super::open_path(path).unwrap();
|
||||
|
||||
let path = "D:\\Programs\\Steam\\steamapps\\common\\Counter-Strike Global Offensive\\game\\bin\\win64";
|
||||
println!("test open path: {}", path);
|
||||
open_path(path).unwrap();
|
||||
super::open_path(path).unwrap();
|
||||
|
||||
let path = "%appdata%/Wmpvp/demo";
|
||||
println!("test open path: {}", path);
|
||||
open_path(path).unwrap()
|
||||
super::open_path(path).unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_exe_path() {
|
||||
let path = get_exe_path("steam").expect("failed");
|
||||
let path = super::get_exe_path("steam").expect("failed");
|
||||
println!("test get steam path: {}", path);
|
||||
|
||||
get_exe_path("not_running").expect("failed");
|
||||
super::get_exe_path("not_running").expect("failed");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,6 @@ fn build_vdf(json_value: &serde_json::Value, vdf_data: &mut String, indent_level
|
||||
}
|
||||
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
static VDF_DATA: &str = r#""users"
|
||||
{
|
||||
@@ -132,7 +131,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_to_json() {
|
||||
// let expected_json = r#"{"key1": "value1","key2": "value2","subkey": {"key3": "value3"}}"#;
|
||||
let json_data = to_json(VDF_DATA);
|
||||
let json_data = super::to_json(VDF_DATA);
|
||||
println!("{}", json_data);
|
||||
|
||||
// 解析json
|
||||
@@ -145,7 +144,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_to_vdf() {
|
||||
// let json_data = r#"{"key1": "value1","key2": "value2","subkey": {"key3": "value3"}}"#;
|
||||
let vdf_data = to_vdf(JSON_DATA);
|
||||
let vdf_data = super::to_vdf(JSON_DATA);
|
||||
|
||||
println!("{}", vdf_data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user