| 205 | } |
| 206 | |
| 207 | bool TouchFile(const FilePath& path, |
| 208 | const Time& last_accessed, |
| 209 | const Time& last_modified) { |
| 210 | int flags = File::FLAG_OPEN | File::FLAG_WRITE_ATTRIBUTES; |
| 211 | |
| 212 | #if defined(OS_WIN) |
| 213 | // On Windows, FILE_FLAG_BACKUP_SEMANTICS is needed to open a directory. |
| 214 | if (DirectoryExists(path)) |
| 215 | flags |= File::FLAG_BACKUP_SEMANTICS; |
| 216 | #endif // OS_WIN |
| 217 | |
| 218 | File file(path, flags); |
| 219 | if (!file.IsValid()) |
| 220 | return false; |
| 221 | |
| 222 | return file.SetTimes(last_accessed, last_modified); |
| 223 | } |
| 224 | |
| 225 | bool CloseFile(FILE* file) { |
| 226 | if (file == NULL) |