Application adds path to plugins to environment variable PATH on startup. Plugin loading is working correct now.
This commit is contained in:
@@ -4,10 +4,26 @@
|
|||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
QString exePath = a.applicationDirPath();
|
||||||
|
exePath = exePath.append("\\plugins");
|
||||||
|
|
||||||
|
wchar_t Path[10000];
|
||||||
|
::GetEnvironmentVariable(L"PATH", Path, sizeof(Path) / sizeof(TCHAR));
|
||||||
|
QString pathVar = QString::fromWCharArray(Path);
|
||||||
|
QString newPath = exePath.append(";").append(pathVar);
|
||||||
|
|
||||||
|
::SetEnvironmentVariable(TEXT("PATH"), newPath.toStdWString().c_str());
|
||||||
|
#endif
|
||||||
|
|
||||||
QTranslator qtTranslator;
|
QTranslator qtTranslator;
|
||||||
qtTranslator.load("qt_" + QLocale::system().name(),
|
qtTranslator.load("qt_" + QLocale::system().name(),
|
||||||
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||||
|
|||||||
Reference in New Issue
Block a user