BOOL MRE::FUpdateTargetFile ( SZC szTarget, TrgType trgtype ) { // REVIEW:TODO actually do the patch (novel concept) _TCHAR szCanon [ ctchMrePathMax ]; NI ni; PFI pfi; BOOL fRet = fFalse; ni = NiFromName ( SzFullCanonFilename ( szTarget, szCanon, countof(szCanon) ) ); if ( trgtype == trgtypeObject && FFileInfoFromNi ( ni, &pfi ) ) { MREFT mreft; QWORD cb; switch ( m_lcrechandler.LcrhrPatchFile ( pfi->BuildId(), szCanon ) ) { case LCRecHandler::lcrhrFail : case LCRecHandler::lcrhrNotApplicable : { _tutime ( szCanon, NULL); break; } case LCRecHandler::lcrhrSuccess : { break; } default : { notReached(); } } IncBuildId(); // update our FILEINFO so that we don't have to deal with those // changes on our next refresh. if ( ::FFileInfo ( szCanon, mreft, cb ) ) { pfi->fiTime = mreft; pfi->fiSize = cb; pfi->SetBuildId ( BuildId() ); } fRet = fTrue; } else { fRet = !_tutime ( szCanon, NULL); } m_mrelog.LogNote ( "Note: update of '%s', type = %d, was %ssuccessful.\n", szCanon, int(trgtype), fRet ? "" : "un" ); return fRet; }
bool ZipPlatform::SetFileModTime(LPCTSTR lpFileName, time_t ttime) { struct _utimbuf ub; ub.actime = time(NULL); ub.modtime = ttime == -1 ? time(NULL) : ttime; // if wrong file time, set it to the current return _tutime(lpFileName, &ub) == 0; }
/** * @brief Update file's modification time. * @param [in] info Contains filename, path and file times to update. */ void files_UpdateFileTime(const DiffFileInfo & info) { String path = paths_ConcatPath(info.path, info.filename); _utimbuf times = {0}; times.modtime = info.mtime; _tutime(path.c_str(), ×); }
int our_utime(char *path, struct utimbuf *buf) { #ifdef _WINDOWS LPTSTR p = NULL; int ret = -1; p = utf8_to_lptstr((LPSTR) path); if(p){ ret = _tutime(p, buf); fs_give((void **) &p); } return ret; #else /* UNIX */ return(utime(fname_to_locale(path), buf)); #endif /* UNIX */ }
bool FileMisc::ResetLastModified(const TCHAR* szPath) { ::SetFileAttributes(szPath, FILE_ATTRIBUTE_NORMAL); return (_tutime(szPath, NULL) == 0); }