diff options
Diffstat (limited to 'library/std/src/sys/unix/os.rs')
| -rw-r--r-- | library/std/src/sys/unix/os.rs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs index bbfe846e315..1d5ffb07321 100644 --- a/library/std/src/sys/unix/os.rs +++ b/library/std/src/sys/unix/os.rs @@ -128,6 +128,12 @@ pub fn error_string(errno: i32) -> String { } } +#[cfg(target_os = "espidf")] +pub fn getcwd() -> io::Result<PathBuf> { + Ok(PathBuf::from("/")) +} + +#[cfg(not(target_os = "espidf"))] pub fn getcwd() -> io::Result<PathBuf> { let mut buf = Vec::with_capacity(512); loop { @@ -154,6 +160,12 @@ pub fn getcwd() -> io::Result<PathBuf> { } } +#[cfg(target_os = "espidf")] +pub fn chdir(p: &path::Path) -> io::Result<()> { + super::unsupported::unsupported() +} + +#[cfg(not(target_os = "espidf"))] pub fn chdir(p: &path::Path) -> io::Result<()> { let p: &OsStr = p.as_ref(); let p = CString::new(p.as_bytes())?; @@ -432,6 +444,11 @@ pub fn current_exe() -> io::Result<PathBuf> { path.canonicalize() } +#[cfg(target_os = "espidf")] +pub fn current_exe() -> io::Result<PathBuf> { + super::unsupported::unsupported() +} + pub struct Env { iter: vec::IntoIter<(OsString, OsString)>, } @@ -541,6 +558,7 @@ pub fn unsetenv(n: &OsStr) -> io::Result<()> { } } +#[cfg(not(target_os = "espidf"))] pub fn page_size() -> usize { unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize } } @@ -563,7 +581,8 @@ pub fn home_dir() -> Option<PathBuf> { target_os = "ios", target_os = "emscripten", target_os = "redox", - target_os = "vxworks" + target_os = "vxworks", + target_os = "espidf" ))] unsafe fn fallback() -> Option<OsString> { None @@ -573,7 +592,8 @@ pub fn home_dir() -> Option<PathBuf> { target_os = "ios", target_os = "emscripten", target_os = "redox", - target_os = "vxworks" + target_os = "vxworks", + target_os = "espidf" )))] unsafe fn fallback() -> Option<OsString> { let amt = match libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX) { |
