Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Changed the location of the database files to point to ~/.cache
directory. Created a method syncDir to return the CACHE_DIR

Signed-off-by: Sateesh Kavuri <sateesh@mobilitas.co>
  • Loading branch information
Sateesh Kavuri committed Apr 2, 2013
1 parent 9eea9b4 commit d9234ca
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/DatabaseHandler.cpp
Expand Up @@ -34,6 +34,7 @@
#include "DatabaseHandler.h"

#include "LogMacros.h"
#include "SyncCommonDefs.h"

using namespace DataSync;

Expand All @@ -47,7 +48,14 @@ DatabaseHandler::DatabaseHandler( const QString& aDbFile )

iConnectionName = CONNECTIONNAME + QString::number( connectionNumber++ );
iDb = QSqlDatabase::addDatabase( "QSQLITE", iConnectionName );
iDb.setDatabaseName( aDbFile );

QDir cacheDir;
cacheDir.mkdir( Sync::syncCacheDir() );
QString path( Sync::syncCacheDir() );
path.append( QDir::separator() ).append( aDbFile );
path = QDir::toNativeSeparators( path );

iDb.setDatabaseName( path );
if(!iDb.open())
LOG_CRITICAL("can not open database");

Expand Down

0 comments on commit d9234ca

Please sign in to comment.