Changeset 9b5a80ff in confclerk_git


Ignore:
Timestamp:
09/05/12 21:30:08 (10 years ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master, qt5
Children:
a8f8b5d
Parents:
1f12b6b
Message:

Added a second possibility to create the directory and removed the TODO.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sql/sqlengine.cpp

    r1f12b6b r9b5a80ff  
    4747
    4848void SqlEngine::open() {
     49    // we may have to create the directory of the database
    4950    QFileInfo dbFilenameInfo(dbFilename);
    50     dbFilenameInfo.absoluteDir().mkpath("."); // TODO: handle error
     51
     52    // First possibility (works with Linux, not tested on Windows:
     53    // QDir cwd;
     54    // cwd.mkpath(dbFilenameInfo.absolutePath());
     55
     56    // Second possibility (works on Windows)
     57    dbFilenameInfo.absoluteDir().mkpath(".");
     58
     59    // We don't have to handle errors because in worst case, opening the database will fail
     60    // and db.isOpen() returns false.
    5161    db = QSqlDatabase::addDatabase("QSQLITE");
    5262    db.setDatabaseName(dbFilename);
Note: See TracChangeset for help on using the changeset viewer.