MCPcopy Create free account
hub / github.com/apache/brpc / TouchFile

Function TouchFile

src/butil/file_util.cc:207–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207bool 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
225bool CloseFile(FILE* file) {
226 if (file == NULL)

Callers 1

TEST_FFunction · 0.85

Calls 3

DirectoryExistsFunction · 0.85
SetTimesMethod · 0.80
IsValidMethod · 0.45

Tested by 1

TEST_FFunction · 0.68