Navigation Menu

Skip to content

Commit

Permalink
[tests] Fix failures on opening database file
Browse files Browse the repository at this point in the history
QSQLITE driver automatically creates database file only if the directory exists.

Relates NEMO#664
  • Loading branch information
martyone committed May 22, 2013
1 parent 93e239f commit 4a3a727
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/DatabaseHandler.cpp
Expand Up @@ -49,11 +49,10 @@ DatabaseHandler::DatabaseHandler( const QString& aDbFile )
iConnectionName = CONNECTIONNAME + QString::number( connectionNumber++ );
iDb = QSqlDatabase::addDatabase( "QSQLITE", iConnectionName );

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

iDb.setDatabaseName( path );
if(!iDb.open())
Expand Down

0 comments on commit 4a3a727

Please sign in to comment.