File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -1111,6 +1111,11 @@ impl File {
11111111 /// `futimes` on macOS before 10.13) and the `SetFileTime` function on Windows. Note that this
11121112 /// [may change in the future][changes].
11131113 ///
1114+ /// On most platforms, including UNIX and Windows platforms, this function can also change the
1115+ /// timestamps of a directory. To get a `File` representing a directory in order to call
1116+ /// `set_times`, open the directory with `File::open` without attempting to obtain write
1117+ /// permission.
1118+ ///
11141119 /// [changes]: io#platform-specific-behavior
11151120 ///
11161121 /// # Errors
@@ -1128,7 +1133,7 @@ impl File {
11281133 /// use std::fs::{self, File, FileTimes};
11291134 ///
11301135 /// let src = fs::metadata("src")?;
1131- /// let dest = File::options().write(true). open("dest")?;
1136+ /// let dest = File::open("dest")?;
11321137 /// let times = FileTimes::new()
11331138 /// .set_accessed(src.accessed()?)
11341139 /// .set_modified(src.modified()?);
You can’t perform that action at this time.
0 commit comments