wxDateTime GPCB_FPL_CACHE::GetLibModificationTime() const { if( !m_lib_path.DirExists() ) return wxDateTime::Now(); return m_lib_path.GetModificationTime(); }
// // Returns true if this Cygwin installation should be updated (or installed for the first time.) // Returns false if we are up-to-date. // bool eDocumentPath_shouldUpdateCygwin(wxDateTime &stampTime, const wxFileName &supportFile){ // E's support folder comes with a network installer for Cygwin. // Newer versions of E may come with newer Cygwin versions. // If the user already has Cygwin installed, we still check the // bundled installer to see if it is newer; if so, then we need to // re-install Cygwin at the newer version. if (!stampTime.IsValid()) return true; // First time, so we need to update. wxDateTime updateTime = supportFile.GetModificationTime(); // Windows doesn't store milliseconds; we clear out this part of the time. updateTime.SetMillisecond(0); updateTime.SetSecond(0); stampTime.SetMillisecond(0); stampTime.SetSecond(0); // If the times are the same, no update needed. if (updateTime == stampTime) return false; // ...else the dates differ and we need to update. wxLogDebug(wxT("InitCygwin: Diff dates")); wxLogDebug(wxT(" e-postinstall: %s"), updateTime.FormatTime()); wxLogDebug(wxT(" last-e-update: %s"), stampTime.FormatTime()); return true; }
bool GPCB_FPL_CACHE_ITEM::IsModified() const { if( !m_file_name.FileExists() ) return false; return m_file_name.GetModificationTime() != m_mod_time; }
bool wxExCompareFile(const wxFileName& file1, const wxFileName& file2) { if (wxConfigBase::Get()->Read(_("Comparator")).empty()) { return false; } const wxString arguments = (file1.GetModificationTime() < file2.GetModificationTime()) ? "\"" + file1.GetFullPath() + "\" \"" + file2.GetFullPath() + "\"": "\"" + file2.GetFullPath() + "\" \"" + file1.GetFullPath() + "\""; if (wxExecute(wxConfigBase::Get()->Read(_("Comparator")) + " " + arguments) == 0) { return false; } wxLogStatus(_("Compared") + ": " + arguments); return true; }
const wxString wxExPrintHeader(const wxFileName& filename) { if (filename.FileExists()) { return wxExGetEndOfText( filename.GetFullPath() + " " + filename.GetModificationTime().Format(), 80); } else { return _("Printed") + ": " + wxDateTime::Now().Format(); } }
// // Gets the cygwin last update time, migrating state form previous e versions if needed. // wxDateTime get_last_cygwin_update() { wxDateTime stampTime; wxLongLong dateVal; eSettings& settings = eGetSettings(); if (settings.GetSettingLong(wxT("cyg_date"), dateVal)) stampTime = wxDateTime(dateVal); // In older versions it could be saved as filestamp if (!stampTime.IsValid()) { const wxFileName timestamp(eDocumentPath::CygwinPath() + wxT("\\etc\\setup\\last-e-update")); if (timestamp.FileExists()) { stampTime = timestamp.GetModificationTime(); // Save in new location settings.SetSettingLong(wxT("cyg_date"), stampTime.GetValue()); } } return stampTime; }
void wxExLogStatus(const wxFileName& fn, long flags) { if (!fn.IsOk()) { return; } wxString text = (flags & STAT_FULLPATH ? fn.GetFullPath(): fn.GetFullName()); if (fn.FileExists()) { const wxString what = (flags & STAT_SYNC ? _("Synchronized"): _("Modified")); text += " " + what + " " + fn.GetModificationTime().Format(); } wxLogStatus(text); }
bool operator()(const wxFileName& one, const wxFileName& two) const { return one.GetModificationTime().GetTicks() > two.GetModificationTime().GetTicks(); }
bool wxExFindOtherFileName( const wxFileName& filename, wxFileName* lastfile) { /* Add the base version if present. E.g. fullpath: F:\CCIS\v990308\com\atis\atis-ctrl\atis-ctrl.cc base: F:\CCIS\ append: \com\atis\atis-ctrl\atis-ctrl.cc */ const wxString fullpath = filename.GetFullPath(); const wxRegEx reg("[/|\\][a-z-]*[0-9]+\\.?[0-9]*\\.?[0-9]*\\.?[0-9]*"); if (!reg.Matches(fullpath.Lower())) { wxLogStatus(_("No version information found")); return false; } size_t start, len; if (!reg.GetMatch(&start, &len)) { wxFAIL; return false; } wxString base = fullpath.substr(0, start); if (!wxEndsWithPathSeparator(base)) { base += wxFileName::GetPathSeparator(); } wxDir dir(base); if (!dir.IsOpened()) { wxFAIL; return false; } wxString filename_string; bool cont = dir.GetFirst(&filename_string, wxEmptyString, wxDIR_DIRS); // only get dirs wxDateTime lastmodtime((time_t)0); const wxString append = fullpath.substr(start + len); bool found = false; // Readme: Maybe use a thread for this. while (cont) { wxFileName fn(base + filename_string + append); if (fn.FileExists() && fn.GetPath().CmpNoCase(filename.GetPath()) != 0 && fn.GetModificationTime() != filename.GetModificationTime()) { found = true; if (fn.GetModificationTime() > lastmodtime) { lastmodtime = fn.GetModificationTime(); *lastfile = fn; } } cont = dir.GetNext(&filename_string); if (wxTheApp != NULL) { wxTheApp->Yield(); } } if (!found) { wxLogStatus(_("No files found")); } return found; }
void UpdateModificationTime() { m_mod_time = m_file_name.GetModificationTime(); }