fix: crossplatform packages

This commit is contained in:
2025-07-05 21:29:59 +02:00
parent 13c82d2316
commit ddf7232424
8 changed files with 65 additions and 38 deletions

View File

@@ -27,15 +27,17 @@ tauri-plugin-sql = "2.3.0"
tauri-plugin-dialog = "2.3.0"
tauri-plugin-fs = "2.4.0"
hardware-id = "0.3.0"
winreg = "0.55.0"
tauri-plugin-cors-fetch = "4.1.0"
sysinfo = "0.35.2"
winapi = { version = "0.3", features = ["winuser"] }
reqwest = { version = "0.12.22", features = ["json", "stream"] }
md5 = "0.8.0"
tokio = { version = "1.46.1", features = ["full"] }
open = "5.3.2"
[target.'cfg(windows)'.dependencies]
winreg = "0.55.0"
winapi = { version = "0.3", features = ["winuser"] }
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-single-instance = "2.3.0"

View File

@@ -17,59 +17,59 @@
"core:window:allow-show",
"fs:default",
{
"identifier": "fs:allow-write",
"identifier": "fs:allow-read",
"allow": [
{
"path": "$HOME/**/*"
}
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
]
},
{
"identifier": "fs:allow-read",
"identifier": "fs:allow-write",
"allow": [
{
"path": "$HOME/**/*"
}
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
]
},
{
"identifier": "fs:allow-exists",
"allow": [
{
"path": "$HOME/**/*"
}
]
},
{
"identifier": "fs:allow-write-file",
"allow": [
{
"path": "$HOME/**/*"
}
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
]
},
{
"identifier": "fs:allow-read-file",
"allow": [
{
"path": "$HOME/**/*"
}
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
]
},
{
"identifier": "fs:allow-write-file",
"allow": [
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
]
},
{
"identifier": "fs:allow-read-text-file",
"allow": [
{
"path": "$HOME/**/*"
}
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
]
},
{
"identifier": "fs:allow-mkdir",
"allow": [
{
"path": "$HOME/**/*"
}
{ "path": "$HOME/.ezpplauncher" },
{ "path": "$HOME/.ezpplauncher/*" },
{ "path": "$HOME/.ezpplauncher/**/*" }
]
}
]

View File

@@ -11,14 +11,12 @@ use tauri::AppHandle;
use tauri::Emitter;
use tokio::fs;
use tokio::io::AsyncWriteExt;
use winreg::RegKey;
use winreg::enums::*;
use crate::utils::{
check_folder_completeness, get_osu_config, get_osu_user_config, get_window_title_by_pid,
set_osu_config_vals, set_osu_user_config_vals,
};
use std::os::windows::process::CommandExt;
#[tauri::command]
pub fn get_hwid() -> String {
@@ -65,8 +63,18 @@ pub fn valid_osu_folder(folder: String) -> bool {
return false;
}
#[cfg(not(windows))]
#[tauri::command]
pub fn find_osu_installation() -> Option<String> {
None
}
#[cfg(windows)]
#[tauri::command]
pub fn find_osu_installation() -> Option<String> {
use winreg::RegKey;
use winreg::enums::*;
let hklm_registry_paths = ["SOFTWARE\\Classes\\osu\\DefaultIcon"];
let hkcr_registry_paths = [
@@ -142,7 +150,7 @@ pub fn find_osu_installation() -> Option<String> {
}
}
}
return None;
None
}
#[tauri::command]

View File

@@ -1,6 +1,4 @@
use std::ffi::OsString;
use std::fs;
use std::os::windows::ffi::OsStringExt;
use std::path::Path;
use sysinfo::Pid;
@@ -178,12 +176,20 @@ pub fn get_osu_config<P: AsRef<Path>>(
return Some(config_map);
}
#[cfg(not(windows))]
pub fn get_window_title_by_pid(_pid: Pid) -> String {
"".to_string()
}
#[cfg(windows)]
pub fn get_window_title_by_pid(pid: Pid) -> String {
use std::sync::{Arc, Mutex};
use winapi::shared::windef::HWND;
use winapi::um::winuser::{
EnumWindows, GetWindowTextW, GetWindowThreadProcessId, IsWindowVisible,
};
use std::ffi::OsString;
use std::os::windows::ffi::OsStringExt;
extern "system" fn enum_windows_proc(
hwnd: HWND,