Skip to content

Commit

Permalink
Improve error message for index dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
scrubbbbs committed Nov 8, 2021
1 parent 2ef9ff9 commit 3329003
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ Database::Database(const QString& path_) {
QDir dir = QDir::current();
if (path_ != "") dir = QDir(path_);

if (!dir.exists())
qFatal("directory does not exist: \"%s\"",
qUtf8Printable(dir.absolutePath()));
_indexDir = dir.absolutePath();

qDebug() << "loading from" << _indexDir;
Expand All @@ -275,9 +278,11 @@ Database::Database(const QString& path_) {
// an index for columns of the "media" table (in setup())
memset(&_mediaIndex, 0xFF, sizeof(_mediaIndex));

Q_ASSERT(dir.mkpath(path()));
if (!dir.mkpath(indexPath()))
qFatal("failed to create index folder: \"%s\"",
qUtf8Printable(indexPath()));

Q_ASSERT(dir.mkpath(cachePath()));
// Q_ASSERT(dir.mkpath(tmpPath()));
Q_ASSERT(dir.mkpath(videoPath()));
}

Expand Down

0 comments on commit 3329003

Please sign in to comment.