Skip to content

Commit

Permalink
Last minute patch to redo 0.1.1 after shutdown path bug found
Browse files Browse the repository at this point in the history
- Replaced absolutePath with path in shutdownApplication for correct
pathing
- Replacing all "\\" with "/" for simplicity
  • Loading branch information
oblivioncth committed Sep 1, 2020
1 parent 2681285 commit bd5b0c8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ int main(int argc, char *argv[])
//-Check for existance of required core applications-----------------------------------
for(QString coreApp : CORE_APP_PATHS)
{
QString fullAppPath = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "\\" + coreApp);
QString fullAppPath = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/" + coreApp);
if(!QFileInfo::exists(fullAppPath) || !QFileInfo(fullAppPath).isFile())
{
QMessageBox::critical(nullptr, QCoreApplication::applicationName(), EXE_NOT_FOUND_ERROR.arg(fullAppPath));
Expand Down Expand Up @@ -180,13 +180,13 @@ int main(int argc, char *argv[])
ErrorCode startupProcedure()
{
// Go to Server directory
QDir::setCurrent(QCoreApplication::applicationDirPath() + "\\" + QFileInfo(PHP_EXE_PATH).dir().path());
QDir::setCurrent(QCoreApplication::applicationDirPath() + "/" + QFileInfo(PHP_EXE_PATH).dir().path());

// Initialize php data
if(QProcess::execute(QFileInfo(PHP_EXE_PATH).fileName(), PHP_ARGS_STARTUP) < 0)
{
QMessageBox::critical(nullptr, QCoreApplication::applicationName(),
EXE_NOT_STARTED_ERROR.arg(QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "\\" + PHP_EXE_PATH)));
EXE_NOT_STARTED_ERROR.arg(QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/" + PHP_EXE_PATH)));
return CORE_APP_NOT_STARTED;
}

Expand All @@ -196,7 +196,7 @@ ErrorCode startupProcedure()
if(!httpdProcess->waitForStarted())
{
QMessageBox::critical(nullptr, QCoreApplication::applicationName(),
EXE_NOT_STARTED_ERROR.arg(QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "\\" + HTTPD_EXE_PATH)));
EXE_NOT_STARTED_ERROR.arg(QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/" + HTTPD_EXE_PATH)));
return CORE_APP_NOT_STARTED;
}

Expand All @@ -222,15 +222,15 @@ ErrorCodes shutdownProcedure(bool silent)
ErrorCode shutdownApplication(QString exePath, QStringList shutdownArgs, bool& silent)
{
// Go to app directory
QDir::setCurrent(QCoreApplication::applicationDirPath() + "\\" + QFileInfo(exePath).absolutePath());
QDir::setCurrent(QCoreApplication::applicationDirPath() + "/" + QFileInfo(exePath).path());

// Shutdown app
if(QProcess::execute(QFileInfo(exePath).fileName(), shutdownArgs) < 0)
{
if(!silent)
{
QMessageBox::critical(nullptr, QCoreApplication::applicationName(),
EXE_NOT_STARTED_ERROR.arg(QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "\\" + exePath)));
EXE_NOT_STARTED_ERROR.arg(QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/" + exePath)));
silent = true;
}
return CORE_APP_NOT_STARTED_FOR_SHUTDOWN;
Expand All @@ -242,7 +242,7 @@ ErrorCode shutdownApplication(QString exePath, QStringList shutdownArgs, bool& s
ErrorCode primaryApplicationExecution(QFile& primaryApp, QStringList primaryAppParameters)
{
// Ensure primary app exists
QString fullAppPath = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "\\" + primaryApp.fileName());
QString fullAppPath = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/" + primaryApp.fileName());

if(!QFileInfo::exists(fullAppPath) || !QFileInfo(fullAppPath).isFile())
{
Expand Down

0 comments on commit bd5b0c8

Please sign in to comment.