Skip to content

Commit

Permalink
FilesTimes support does not build for ESP-IDF
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Aug 3, 2022
1 parent 04f72f9 commit e86c128
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions library/std/src/sys/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,11 @@ impl Default for FileTimes {
fn default() -> Self {
// Redox doesn't appear to support `UTIME_OMIT`, so we stub it out here, and always return
// an error in `set_times`.
#[cfg(target_os = "redox")]
// ESP-IDF does not support `futimens` at all and the behavior for that OS is therefore
// the same as for Redox.
#[cfg(any(target_os = "redox", target_os = "espidf"))]
let omit = libc::timespec { tv_sec: 0, tv_nsec: 0 };
#[cfg(not(target_os = "redox"))]
#[cfg(not(any(target_os = "redox", target_os = "espidf")))]
let omit = libc::timespec { tv_sec: 0, tv_nsec: libc::UTIME_OMIT as _ };
Self([omit; 2])
}
Expand Down Expand Up @@ -1077,8 +1079,10 @@ impl File {

pub fn set_times(&self, times: FileTimes) -> io::Result<()> {
cfg_if::cfg_if! {
if #[cfg(target_os = "redox")] {
if #[cfg(any(target_os = "redox", target_os = "espidf"))] {
// Redox doesn't appear to support `UTIME_OMIT`.
// ESP-IDF does not support `futimens` at all and the behavior for that OS is therefore
// the same as for Redox.
drop(times);
Err(io::const_io_error!(
io::ErrorKind::Unsupported,
Expand Down

0 comments on commit e86c128

Please sign in to comment.