mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-07-28 03:01:54 +08:00
80 lines
2.7 KiB
Diff
80 lines
2.7 KiB
Diff
--- a/libs/hbb_common/src/config.rs
|
|
+++ b/libs/hbb_common/src/config.rs
|
|
@@ -403,36 +403,6 @@ pub fn get_online_state() -> i64 {
|
|
*ONLINE.lock().unwrap().values().max().unwrap_or(&0)
|
|
}
|
|
|
|
-#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
|
-fn patch(path: PathBuf) -> PathBuf {
|
|
- if let Some(_tmp) = path.to_str() {
|
|
- #[cfg(windows)]
|
|
- return _tmp
|
|
- .replace(
|
|
- "system32\\config\\systemprofile",
|
|
- "ServiceProfiles\\LocalService",
|
|
- )
|
|
- .into();
|
|
- #[cfg(target_os = "macos")]
|
|
- return _tmp.replace("Application Support", "Preferences").into();
|
|
- #[cfg(target_os = "linux")]
|
|
- {
|
|
- if _tmp == "/root" {
|
|
- if let Ok(user) = crate::platform::linux::run_cmds_trim_newline("whoami") {
|
|
- if user != "root" {
|
|
- let cmd = format!("getent passwd '{}' | awk -F':' '{{print $6}}'", user);
|
|
- if let Ok(output) = crate::platform::linux::run_cmds_trim_newline(&cmd) {
|
|
- return output.into();
|
|
- }
|
|
- return format!("/home/{user}").into();
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
- }
|
|
- path
|
|
-}
|
|
-
|
|
impl Config2 {
|
|
fn load() -> Config2 {
|
|
let mut config = Config::load_::<Config2>("2");
|
|
@@ -608,15 +578,7 @@ impl Config {
|
|
#[cfg(any(target_os = "android", target_os = "ios"))]
|
|
return PathBuf::from(APP_HOME_DIR.read().unwrap().as_str());
|
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
|
- {
|
|
- if let Some(path) = dirs_next::home_dir() {
|
|
- patch(path)
|
|
- } else if let Ok(path) = std::env::current_dir() {
|
|
- path
|
|
- } else {
|
|
- std::env::temp_dir()
|
|
- }
|
|
- }
|
|
+ PathBuf::from("/var/run/rustdesk-server")
|
|
}
|
|
|
|
pub fn path<P: AsRef<Path>>(p: P) -> PathBuf {
|
|
@@ -628,19 +590,12 @@ impl Config {
|
|
}
|
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
|
{
|
|
- #[cfg(not(target_os = "macos"))]
|
|
- let org = "".to_owned();
|
|
#[cfg(target_os = "macos")]
|
|
let org = ORG.read().unwrap().clone();
|
|
// /var/root for root
|
|
- if let Some(project) =
|
|
- directories_next::ProjectDirs::from("", &org, &APP_NAME.read().unwrap())
|
|
- {
|
|
- let mut path = patch(project.config_dir().to_path_buf());
|
|
- path.push(p);
|
|
- return path;
|
|
- }
|
|
- "".into()
|
|
+ let mut path = PathBuf::from("/var/run/rustdesk-server");
|
|
+ path.push(p);
|
|
+ path
|
|
}
|
|
}
|
|
|