correct re-launch implementation for windows

This commit is contained in:
Axel Kohlmeyer
2023-08-15 23:13:31 -04:00
parent 65cd6a3f2a
commit 653f0c4d8a

View File

@ -48,8 +48,8 @@
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#define execv(exe, args) _execv(exe, args)
#include <process.h>
#define execl(exe, arg0, arg1) _execl(exe, arg0, arg1)
#else
#include <unistd.h>
#endif
@ -158,8 +158,9 @@ void Preferences::accept()
"LAMMPS-GUI must be relaunched."),
QMessageBox::Ok);
msg.exec();
execv(QCoreApplication::applicationFilePath().toStdString().c_str(), nullptr);
fprintf(stderr, "after relaunch\n");
const char *path = QCoreApplication::applicationFilePath().toStdString().c_str();
const char *arg0 = QCoreApplication::arguments().at(0).toStdString().c_str();
execl(path, arg0, nullptr);
}
QDialog::accept();
}