add check whether libcurl support was compiled into LAMMPS and geturl is functional
This commit is contained in:
@ -1995,6 +1995,16 @@ static const QString geturl =
|
||||
|
||||
void LammpsGui::setup_tutorial(int tutno, const QString &dir, bool purgedir, bool getsolution)
|
||||
{
|
||||
constexpr int BUFLEN = 1024;
|
||||
char errorbuf[BUFLEN];
|
||||
|
||||
if (!lammps.config_has_curl_support()) {
|
||||
QMessageBox::critical(this, "LAMMPS-GUI tutorial files download error",
|
||||
"<p align=\"center\">LAMMPS must be compiled with libcurl to support "
|
||||
"downloading files</p>");
|
||||
return;
|
||||
}
|
||||
|
||||
QDir directory(dir);
|
||||
directory.cd(dir);
|
||||
|
||||
@ -2008,12 +2018,10 @@ void LammpsGui::setup_tutorial(int tutno, const QString &dir, bool purgedir, boo
|
||||
// download and process manifest for selected tutorial
|
||||
// must check for error after download, e.g. when there is no network.
|
||||
|
||||
lammps.command(geturl.arg(tutno).arg(".manifest").toStdString().c_str());
|
||||
lammps.command(geturl.arg(tutno).arg(".manifest"));
|
||||
if (lammps.has_error()) {
|
||||
constexpr int BUFLEN = 1024;
|
||||
char errorbuf[BUFLEN];
|
||||
lammps.get_last_error_message(errorbuf, BUFLEN);
|
||||
QMessageBox::critical(this, "LAMMPS-GUI download error", QString(errorbuf));
|
||||
QMessageBox::critical(this, "LAMMPS-GUI tutorial files download error", QString(errorbuf));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -339,6 +339,15 @@ bool LammpsWrapper::config_accelerator(const char *package, const char *category
|
||||
#endif
|
||||
}
|
||||
|
||||
bool LammpsWrapper::config_has_curl_support() const
|
||||
{
|
||||
#if defined(LAMMPS_GUI_USE_PLUGIN)
|
||||
return ((liblammpsplugin_t *)plugin_handle)->config_has_curl_support() != 0;
|
||||
#else
|
||||
return lammps_config_has_curl_support() != 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool LammpsWrapper::has_gpu_device() const
|
||||
{
|
||||
#if defined(LAMMPS_GUI_USE_PLUGIN)
|
||||
|
||||
@ -62,6 +62,7 @@ public:
|
||||
|
||||
bool config_accelerator(const char *package, const char *category, const char *setting) const;
|
||||
bool config_has_package(const char *pkg) const;
|
||||
bool config_has_curl_support() const;
|
||||
bool has_gpu_device() const;
|
||||
|
||||
bool load_lib(const char *lammpslib);
|
||||
|
||||
Reference in New Issue
Block a user