Also use fallback for futimens on Android
futimens requires Android API level 19, and std still supports older API levels.
This commit is contained in:
parent
828b637c2a
commit
e387cff7a3
@ -19,7 +19,7 @@
|
|||||||
target_os = "ios",
|
target_os = "ios",
|
||||||
))]
|
))]
|
||||||
use crate::sys::weak::syscall;
|
use crate::sys::weak::syscall;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(any(target_os = "android", target_os = "macos"))]
|
||||||
use crate::sys::weak::weak;
|
use crate::sys::weak::weak;
|
||||||
|
|
||||||
use libc::{c_int, mode_t};
|
use libc::{c_int, mode_t};
|
||||||
@ -1064,8 +1064,8 @@ pub fn set_permissions(&self, perm: FilePermissions) -> io::Result<()> {
|
|||||||
|
|
||||||
pub fn set_times(&self, times: FileTimes) -> io::Result<()> {
|
pub fn set_times(&self, times: FileTimes) -> io::Result<()> {
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
// futimens requires macOS 10.13
|
// futimens requires macOS 10.13, and Android API level 19
|
||||||
if #[cfg(target_os = "macos")] {
|
if #[cfg(any(target_os = "android", target_os = "macos"))] {
|
||||||
fn ts_to_tv(ts: &libc::timespec) -> libc::timeval {
|
fn ts_to_tv(ts: &libc::timespec) -> libc::timeval {
|
||||||
libc::timeval { tv_sec: ts.tv_sec, tv_usec: (ts.tv_nsec / 1000) as _ }
|
libc::timeval { tv_sec: ts.tv_sec, tv_usec: (ts.tv_nsec / 1000) as _ }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user