From 4401265132f4a86a797dd01dc5dd76916b25bcd7 Mon Sep 17 00:00:00 2001 From: pali6 <6pali6@gmail.com> Date: Wed, 27 Nov 2024 13:14:32 +0100 Subject: [PATCH] in touch open file in write mode on Windows this is necessary to modify times of a file --- collector/src/utils/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collector/src/utils/fs.rs b/collector/src/utils/fs.rs index ff801d4dd..e38176df4 100644 --- a/collector/src/utils/fs.rs +++ b/collector/src/utils/fs.rs @@ -45,7 +45,7 @@ pub fn rename, Q: AsRef>(from: P, to: Q) -> anyhow::Result< /// Touch a file, resetting its modification time. pub fn touch(path: &Path) -> anyhow::Result<()> { - let file = File::options().read(true).open(path)?; + let file = File::options().read(true).write(true).open(path)?; file.set_modified(SystemTime::now()) .with_context(|| format!("touching file {:?}", path))?;