(path: PathBuf)
| 395 | |
| 396 | #[cfg(not(any(target_os = "android", target_os = "ios")))] |
| 397 | fn patch(path: PathBuf) -> PathBuf { |
| 398 | if let Some(_tmp) = path.to_str() { |
| 399 | #[cfg(windows)] |
| 400 | return _tmp |
| 401 | .replace( |
| 402 | "system32\\config\\systemprofile", |
| 403 | "ServiceProfiles\\LocalService", |
| 404 | ) |
| 405 | .into(); |
| 406 | #[cfg(target_os = "macos")] |
| 407 | return _tmp.replace("Application Support", "Preferences").into(); |
| 408 | #[cfg(target_os = "linux")] |
| 409 | { |
| 410 | if _tmp == "/root" { |
| 411 | if let Ok(user) = crate::platform::linux::run_cmds_trim_newline("whoami") { |
| 412 | if user != "root" { |
| 413 | let cmd = format!("getent passwd '{}' | awk -F':' '{{print $6}}'", user); |
| 414 | if let Ok(output) = crate::platform::linux::run_cmds_trim_newline(&cmd) { |
| 415 | return output.into(); |
| 416 | } |
| 417 | return format!("/home/{user}").into(); |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | } |
| 422 | } |
| 423 | path |
| 424 | } |
| 425 | |
| 426 | impl Config2 { |
| 427 | fn load() -> Config2 { |
no test coverage detected