feat: Check if crun exists

检查crun是否存在,如果不存在打印提示

Log:
This commit is contained in:
myml 2024-02-28 10:58:37 +08:00 committed by deepin-bot[bot]
parent fe9e7ec754
commit 319f2db592
3 changed files with 13 additions and 0 deletions

View File

@ -58,6 +58,10 @@ int main(int argc, char **argv)
logger->set_level(spdlog::level::trace);
}
auto path = QStandardPaths::findExecutable("crun");
if (path.isEmpty()) {
qCritical() << "crun not found";
return -1;
}
auto crun = ocppi::cli::crun::Crun::New(path.toStdString(), logger);
if (!crun.has_value()) {
std::rethrow_exception(crun.error());

View File

@ -197,6 +197,11 @@ int main(int argc, char **argv)
logger->set_level(spdlog::level::trace);
}
auto path = QStandardPaths::findExecutable("crun");
if (path.isEmpty()) {
qCritical() << "crun not found";
QCoreApplication::exit(-1);
return;
}
auto crun = ocppi::cli::crun::Crun::New(path.toStdString(), logger);
if (!crun.has_value()) {
std::rethrow_exception(crun.error());

View File

@ -61,6 +61,10 @@ auto main(int argc, char *argv[]) -> int
logger->set_level(spdlog::level::trace);
}
auto path = QStandardPaths::findExecutable("crun");
if (path.isEmpty()) {
qCritical() << "crun not found";
return -1;
}
auto crun = ocppi::cli::crun::Crun::New(path.toStdString(), logger);
if (!crun.has_value()) {
std::rethrow_exception(crun.error());