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 {
1111
1111
/// `futimes` on macOS before 10.13) and the `SetFileTime` function on Windows. Note that this
1112
1112
/// [may change in the future][changes].
1113
1113
///
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
+ ///
1114
1119
/// [changes]: io#platform-specific-behavior
1115
1120
///
1116
1121
/// # Errors
@@ -1128,7 +1133,7 @@ impl File {
1128
1133
/// use std::fs::{self, File, FileTimes};
1129
1134
///
1130
1135
/// let src = fs::metadata("src")?;
1131
- /// let dest = File::options().write(true). open("dest")?;
1136
+ /// let dest = File::open("dest")?;
1132
1137
/// let times = FileTimes::new()
1133
1138
/// .set_accessed(src.accessed()?)
1134
1139
/// .set_modified(src.modified()?);
You can’t perform that action at this time.
0 commit comments