1
0
mirror of https://github.com/termux/termux-packages synced 2024-06-21 18:07:08 +00:00
termux-packages/packages/nushell/user_home_dir.patch

30 lines
826 B
Diff
Raw Permalink Normal View History

2022-05-05 01:09:41 +00:00
--- a/crates/nu-path/src/tilde.rs
+++ b/crates/nu-path/src/tilde.rs
2022-09-07 05:03:50 +00:00
@@ -1,4 +1,4 @@
-#[cfg(all(unix, not(target_os = "macos")))]
+#[cfg(all(unix, not(target_os = "macos"), not(target_os = "android")))]
use pwd::Passwd;
use std::path::{Path, PathBuf};
@@ -45,7 +45,7 @@
}
}
-#[cfg(all(unix, not(target_os = "macos")))]
+#[cfg(all(unix, not(target_os = "macos"), not(target_os = "android")))]
fn user_home_dir(username: &str) -> PathBuf {
let passwd = Passwd::from_name(username);
match &passwd.ok() {
@@ -60,6 +60,11 @@
2022-05-05 01:09:41 +00:00
// Returns home dir of user.
}
+#[cfg(target_os = "android")]
2022-09-07 05:03:50 +00:00
+fn user_home_dir(_username: &str) -> PathBuf {
2022-05-05 01:09:41 +00:00
+ PathBuf::from(String::from("@TERMUX_HOME@"))
+}
+
#[cfg(target_os = "macos")]
fn user_home_dir(username: &str) -> PathBuf {
match dirs_next::home_dir() {