Mercurial > mercurial > hgweb_searcher03.cgi
view src/update.cpp @ 18:a8e6e5769e3b
Small fixes.
author | pyon@macmini |
---|---|
date | Sat, 29 Nov 2014 11:02:35 +0900 |
parents | 1ba97995f642 |
children | 226774bf49fc |
line wrap: on
line source
// Filename : update.cpp // Last Change: 19-Jun-2014. #include "update.h" void CheckNewFiles( wxString shared ) { // index wxString cfile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("ccn.db"); wxFileName fn( cfile ); wxDateTime ct = fn.GetModificationTime(); wxString nfile = shared + wxFILE_SEP_PATH + wxT("ccn.db"); fn.Assign( nfile ); wxDateTime nt = fn.GetModificationTime(); if ( nt - ct > wxTimeSpan::Week() ) { wxMessageDialog md( NULL, wxT("インデックスが古くなっています.\n新しいインデックスを取得しますか?"), wxT("Information"), wxYES_NO|wxOK_DEFAULT ); if ( md.ShowModal() == wxID_YES ) { GetFile( cfile, nfile ); } } else { if ( ct - nt > wxTimeSpan::Day() ) PutFile( nfile, cfile ); } // hhs cfile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("hhs.db"); fn.Assign( cfile ); ct = fn.GetModificationTime(); nfile = shared + wxFILE_SEP_PATH + wxT("hhs.db"); fn.Assign( nfile ); nt = fn.GetModificationTime(); if ( nt - ct > wxTimeSpan::Week() ) { wxMessageDialog md( NULL, wxT("被保険者情報の最新版があります.\n被保険者情報を取得しますか?"), wxT("Information"), wxYES_NO|wxOK_DEFAULT ); if ( md.ShowModal() == wxID_YES ) { GetFile( cfile, nfile ); } } else { if ( ct - nt > wxTimeSpan::Day() ) PutFile( nfile, cfile ); } } void GetFile( wxString target, wxString newfile ) { wxCopyFile( newfile, target, true ); wxMessageBox( wxT("アップデート完了.") ); } void PutFile( wxString newfile, wxString target ) { wxCopyFile( target, newfile, true ); }