mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-12 23:24:35 +01:00
Use different resource path in certain cases
This is janky, but does not require AppHandle.
This commit is contained in:
@@ -119,10 +119,28 @@ pub fn open_in_browser(url: String) {
|
|||||||
pub fn install_location() -> String {
|
pub fn install_location() -> String {
|
||||||
let mut exe_path = std::env::current_exe().unwrap();
|
let mut exe_path = std::env::current_exe().unwrap();
|
||||||
|
|
||||||
// Get the path to the executable.
|
#[cfg(windows)]
|
||||||
exe_path.pop();
|
{
|
||||||
|
// Get the path to the executable.
|
||||||
|
exe_path.pop();
|
||||||
|
|
||||||
return exe_path.to_str().unwrap().to_string();
|
return exe_path.to_str().unwrap().to_string();
|
||||||
|
}
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
{
|
||||||
|
let bin_name = exe_path.file_name().unwrap().to_str().unwrap().to_string();
|
||||||
|
exe_path.pop();
|
||||||
|
if exe_path.starts_with("/usr/bin") {
|
||||||
|
let mut path = PathBuf::from("/usr/lib");
|
||||||
|
path.push(bin_name);
|
||||||
|
path
|
||||||
|
} else {
|
||||||
|
exe_path
|
||||||
|
}
|
||||||
|
.to_str()
|
||||||
|
.unwrap()
|
||||||
|
.to_string()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
|
|||||||
Reference in New Issue
Block a user