diff src/main.cpp @ 13:f5ffc34f045a

manage DB.
author pyon@macmini
date Wed, 14 Nov 2018 19:43:40 +0900
parents 799b6008db8e
children c262e17de9b1
line wrap: on
line diff
--- a/src/main.cpp	Tue Nov 13 21:11:20 2018 +0900
+++ b/src/main.cpp	Wed Nov 14 19:43:40 2018 +0900
@@ -1,5 +1,5 @@
 // Filename   : main.cpp
-// Last Change: 2018-11-09 金 11:54:20.
+// Last Change: 2018-11-14 水 12:54:16.
 //
 
 #include <wx/socket.h>
@@ -51,8 +51,9 @@
 	// Main Window
 	MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxEmptyString, wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE );
 	mainframe->SetServer( m_serveraddr, m_serverport );
+	mainframe->SetDBdir( m_dbdir );
 	mainframe->InDevelop( true );
-	if ( !mainframe->GetDB() ) {
+	if ( !mainframe->GetDB( 1, 1, 1 ) ) {
 		mainframe->Destroy();
 		return true;
 	}
@@ -124,6 +125,9 @@
 
 int MyApp::OnExit()
 {
+	RemoveFile( wxT( "hhs.csv.tmp" ) );
+	RemoveFile( wxT( "hhs.csv" ) );
+	RemoveFile( wxT( "index.db.tmp" ) );
 	RemoveFile( wxT( "auth.db" ) );
 	RemoveFile( wxT( "hhs.db" ) );
 	RemoveFile( wxT( ".cache/*" )  );
@@ -142,6 +146,9 @@
     config->Read( wxT( "w" ), &rect.width );
     config->Read( wxT( "h" ), &rect.height );
 
+    config->SetPath( wxT( "/DBManage" ) );
+    config->Read( wxT( "dbdir" ), &m_dbdir );
+
     config->SetPath( wxT( "/Server" ) );
     config->Read( wxT( "proxy_address" ), &m_serveraddr );
     config->Read( wxT( "proxy_port" ),    &m_serverport );