make behavior consistent in adding compiler bindirs to Path

When running the compiled user program, current compiler's
binary directories should be added to the beginning of the
Path environment variable instead of the end, in order to
avoid loading other user-installed versions of
MinGW libraries (such as libstdc++).

Previously, in openShell of mainwindow.cpp the behavior has already
been updated, but in executablerunner.cpp and ojproblemcasesrunner.cpp,
the behavior is different. Now they have been changed to be
consistent with the one in openShell.
This commit is contained in:
brokencuph 2022-05-30 16:01:28 +08:00
parent e920d230df
commit a96af19f2e
2 changed files with 2 additions and 2 deletions

View File

@ -108,7 +108,7 @@ void ExecutableRunner::run()
}
pathAdded.append(pSettings->dirs().appDir());
if (!path.isEmpty()) {
path+= PATH_SEPARATOR + pathAdded.join(PATH_SEPARATOR);
path= pathAdded.join(PATH_SEPARATOR) + PATH_SEPARATOR + path;
} else {
path = pathAdded.join(PATH_SEPARATOR);
}

View File

@ -73,7 +73,7 @@ void OJProblemCasesRunner::runCase(int index,POJProblemCase problemCase)
}
pathAdded.append(pSettings->dirs().appDir());
if (!path.isEmpty()) {
path+= PATH_SEPARATOR + pathAdded.join(PATH_SEPARATOR);
path= pathAdded.join(PATH_SEPARATOR) + PATH_SEPARATOR + path;
} else {
path = pathAdded.join(PATH_SEPARATOR);
}