MCPcopy Create free account
hub / github.com/Kitware/CMake / Store

Method Store

Source/cmFileTimes.cxx:108–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108cmsys::Status cmFileTimes::Store(std::string const& fileName) const
109{
110 if (!this->IsValid()) {
111 return cmsys::Status::POSIX(EINVAL);
112 }
113
114#if defined(_WIN32) && !defined(__CYGWIN__)
115 cmFileTimes::WindowsHandle handle = CreateFileW(
116 cmSystemTools::ConvertToWindowsExtendedPath(fileName).c_str(),
117 FILE_WRITE_ATTRIBUTES, 0, 0, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0);
118 if (!handle) {
119 return cmsys::Status::Windows_GetLastError();
120 }
121 if (SetFileTime(handle, &this->times->timeCreation,
122 &this->times->timeLastAccess,
123 &this->times->timeLastWrite) == 0) {
124 return cmsys::Status::Windows_GetLastError();
125 }
126#else
127 if (utime(fileName.c_str(), &this->times->timeBuf) < 0) {
128 return cmsys::Status::POSIX_errno();
129 }
130#endif
131 return cmsys::Status::Success();
132}
133
134cmsys::Status cmFileTimes::Copy(std::string const& fromFile,
135 std::string const& toFile)

Callers 5

SetPermissionsMethod · 0.45
CopyMethod · 0.45
HandleRPathChangeCommandFunction · 0.45
HandleRPathSetCommandFunction · 0.45
HandleRPathRemoveCommandFunction · 0.45

Calls 2

IsValidMethod · 0.95
c_strMethod · 0.80

Tested by

no test coverage detected