forge
Explore
Log in

Don't you dare go Hollow

Replace set_modified() with manual impl

Browse files at this commit

b3d2096439f194108bd11c56fbf0ecb1a7a73fdfIvan MolodetskikhParent: 94ded2f
MSRV moment
src/watcher.rsmodified+28 -3
@@ -91,10 +91,11 @@ mod tests {
91 use std::fs::File;91 use std::fs::File;
92 use std::io::Write;92 use std::io::Write;
93 use std::sync::atomic::AtomicU8;93 use std::sync::atomic::AtomicU8;
94- use std::time::SystemTime;
95 94
96 use calloop::channel::sync_channel;95 use calloop::channel::sync_channel;
97 use calloop::EventLoop;96 use calloop::EventLoop;
97+ use smithay::reexports::rustix::fs::{futimens, Timestamps};
98+ use smithay::reexports::rustix::time::Timespec;
98 use xshell::{cmd, Shell};99 use xshell::{cmd, Shell};
99 100
100 use super::*;101 use super::*;
@@ -280,7 +281,19 @@ mod tests {
280 let mut c2 = File::create(d2).unwrap();281 let mut c2 = File::create(d2).unwrap();
281 write!(c2, "a")?;282 write!(c2, "a")?;
282 c2.flush()?;283 c2.flush()?;
283- c2.set_modified(SystemTime::UNIX_EPOCH)?;284+ futimens(
285+ &c2,
286+ &Timestamps {
287+ last_access: Timespec {
288+ tv_sec: 0,
289+ tv_nsec: 0,
290+ },
291+ last_modification: Timespec {
292+ tv_sec: 0,
293+ tv_nsec: 0,
294+ },
295+ },
296+ )?;
284 c2.sync_all()?;297 c2.sync_all()?;
285 drop(c2);298 drop(c2);
286 299
@@ -289,7 +302,19 @@ mod tests {
289 let mut c3 = File::create(d3).unwrap();302 let mut c3 = File::create(d3).unwrap();
290 write!(c3, "b")?;303 write!(c3, "b")?;
291 c3.flush()?;304 c3.flush()?;
292- c3.set_modified(SystemTime::UNIX_EPOCH)?;305+ futimens(
306+ &c3,
307+ &Timestamps {
308+ last_access: Timespec {
309+ tv_sec: 0,
310+ tv_nsec: 0,
311+ },
312+ last_modification: Timespec {
313+ tv_sec: 0,
314+ tv_nsec: 0,
315+ },
316+ },
317+ )?;
293 c3.sync_all()?;318 c3.sync_all()?;
294 drop(c3);319 drop(c3);
295 320