Skip to content

Commit

Permalink
fix: do not run tests if the path to the directory doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
smnppKDAB authored and LeonMatthesKDAB committed Jul 29, 2024
1 parent 45eb945 commit 308e7ba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/core/knutcore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ KnutCore::KnutCore(InternalTag, QObject *parent)
spdlog::cfg::load_env_levels();
}

void KnutCore::process(const QStringList &arguments)
bool KnutCore::process(const QStringList &arguments)
{
// Parse command line options
QCommandLineParser parser;
Expand Down Expand Up @@ -102,6 +102,7 @@ void KnutCore::process(const QStringList &arguments)
} else {
spdlog::error("KnutCore::process - Root directory: {}, does not exist. Cannot open a new project!",
pathDir.absolutePath());
return false;
}
}

Expand Down Expand Up @@ -140,10 +141,11 @@ void KnutCore::process(const QStringList &arguments)
qApp->exit(value.toInt());
},
Qt::QueuedConnection);
return;
return true;
}

doParse(parser);
return true;
}

void KnutCore::initParser(QCommandLineParser &parser) const
Expand Down
2 changes: 1 addition & 1 deletion src/core/knutcore.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class KnutCore : public QObject
public:
explicit KnutCore(QObject *parent = nullptr);

void process(const QStringList &arguments);
bool process(const QStringList &arguments);

protected:
// Used to disambiguate the internal constructor
Expand Down
7 changes: 4 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(gui);

Gui::KnutMain knut;
knut.process(app.arguments());

return app.exec();
if (knut.process(app.arguments()))
return app.exec();
else
return 1;
}

0 comments on commit 308e7ba

Please sign in to comment.