Mercurial > mercurial > hgweb_searcher03.cgi
comparison src/update.cpp @ 20:226774bf49fc
Small fix.
author | pyon@macmini |
---|---|
date | Mon, 08 Dec 2014 19:47:42 +0900 |
parents | 1ba97995f642 |
children |
comparison
equal
deleted
inserted
replaced
19:3bb803d8c1d7 | 20:226774bf49fc |
---|---|
1 // Filename : update.cpp | 1 // Filename : update.cpp |
2 // Last Change: 19-Jun-2014. | 2 // Last Change: 08-Dec-2014. |
3 | 3 |
4 #include "update.h" | 4 #include "update.h" |
5 | 5 |
6 void CheckNewFiles( wxString shared ) | 6 int CheckNewFiles( wxString shared ) |
7 { | 7 { |
8 // index | 8 // index |
9 wxString cfile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("ccn.db"); | 9 wxString cfile = wxGetCwd() + wxFILE_SEP_PATH + wxT("db") + wxFILE_SEP_PATH + wxT("ccn.db"); |
10 wxFileName fn( cfile ); | 10 wxFileName fn( cfile ); |
11 wxDateTime ct = fn.GetModificationTime(); | 11 wxDateTime ct = fn.GetModificationTime(); |
12 | 12 |
13 wxString nfile = shared + wxFILE_SEP_PATH + wxT("ccn.db"); | 13 wxString nfile = shared + wxFILE_SEP_PATH + wxT("ccn.db"); |
14 fn.Assign( nfile ); | 14 fn.Assign( nfile ); |
15 if ( !fn.IsFileReadable() ) { | |
16 wxMessageBox( wxT("共有ファイルにアクセスできなかったので終了します。") ); | |
17 return 1; | |
18 } | |
15 wxDateTime nt = fn.GetModificationTime(); | 19 wxDateTime nt = fn.GetModificationTime(); |
16 | 20 |
17 if ( nt - ct > wxTimeSpan::Week() ) { | 21 if ( nt - ct > wxTimeSpan::Week() ) { |
18 wxMessageDialog md( NULL, wxT("インデックスが古くなっています.\n新しいインデックスを取得しますか?"), wxT("Information"), wxYES_NO|wxOK_DEFAULT ); | 22 wxMessageDialog md( NULL, wxT("インデックスが古くなっています.\n新しいインデックスを取得しますか?"), wxT("Information"), wxYES_NO|wxOK_DEFAULT ); |
19 if ( md.ShowModal() == wxID_YES ) { | 23 if ( md.ShowModal() == wxID_YES ) { |
42 } | 46 } |
43 else { | 47 else { |
44 if ( ct - nt > wxTimeSpan::Day() ) | 48 if ( ct - nt > wxTimeSpan::Day() ) |
45 PutFile( nfile, cfile ); | 49 PutFile( nfile, cfile ); |
46 } | 50 } |
51 | |
52 return 0; | |
47 } | 53 } |
48 | 54 |
49 void GetFile( wxString target, wxString newfile ) | 55 void GetFile( wxString target, wxString newfile ) |
50 { | 56 { |
51 wxCopyFile( newfile, target, true ); | 57 wxCopyFile( newfile, target, true ); |