summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt14
-rw-r--r--src/dlls.manifest (renamed from src/dlls.manifest.qt5)58
-rw-r--r--src/env.cpp7
-rw-r--r--src/env.h1
-rw-r--r--src/main.cpp91
-rw-r--r--src/qt.conf8
6 files changed, 76 insertions, 103 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e95179b8..79389e42 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -223,17 +223,19 @@ target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
)
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest.qt5
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/dlls.manifest
DESTINATION bin/dlls
RENAME dlls.manifest)
-install(FILES ${qm_files} DESTINATION bin/translations)
+install(FILES ${qm_files} DESTINATION bin/dlls/translations)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/stylesheets
- ${CMAKE_CURRENT_SOURCE_DIR}/tutorials
- DESTINATION bin)
+ DESTINATION bin)
+
+install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tutorials
+ DESTINATION bin/dlls)
deploy_qt(BINARIES ModOrganizer.exe uibase.dll plugins/bsa_packer.dll)
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../qdds.dll DESTINATION bin/dlls/imageformats)
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html DESTINATION bin/resources)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../qdds.dll DESTINATION bin/dlls/QtPlugins/imageformats)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/markdown.html DESTINATION bin/dlls/resources)
diff --git a/src/dlls.manifest.qt5 b/src/dlls.manifest
index cae74df1..846a02ae 100644
--- a/src/dlls.manifest.qt5
+++ b/src/dlls.manifest
@@ -1,29 +1,29 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
- <assemblyIdentity type="win32" name="dlls" version="1.0.0.0" processorArchitecture="x86"/>
- <file name="7z.dll"/>
- <file name="archive.dll"/>
- <file name="d3dcompiler_47.dll"/>
- <file name="libEGL.dll"/>
- <file name="libGLESV2.dll"/>
- <file name="liblz4.dll"/>
- <file name="opengl32sw.dll"/>
- <file name="Qt5Core.dll"/>
- <file name="Qt5Gui.dll"/>
- <file name="Qt5Network.dll"/>
- <file name="Qt5Positioning.dll"/>
- <file name="Qt5PrintSupport.dll"/>
- <file name="Qt5Qml.dll"/>
- <file name="Qt5QmlModels.dll"/>
- <file name="Qt5QmlWorkerScript.dll"/>
- <file name="Qt5Quick.dll"/>
- <file name="Qt5QuickWidgets.dll"/>
- <file name="Qt5SerialPort.dll"/>
- <file name="Qt5Svg.dll"/>
- <file name="Qt5WebChannel.dll"/>
- <file name="Qt5WebEngineCore.dll"/>
- <file name="Qt5WebEngineWidgets.dll"/>
- <file name="Qt5WebSockets.dll"/>
- <file name="Qt5Widgets.dll"/>
- <file name="Qt5WinExtras.dll"/>
-</assembly>
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity type="win32" name="dlls" version="1.0.0.0" processorArchitecture="x86"/>
+ <file name="7z.dll"/>
+ <file name="archive.dll"/>
+ <file name="d3dcompiler_47.dll"/>
+ <file name="libEGL.dll"/>
+ <file name="libGLESV2.dll"/>
+ <file name="liblz4.dll"/>
+ <file name="opengl32sw.dll"/>
+ <file name="Qt5Core.dll"/>
+ <file name="Qt5Gui.dll"/>
+ <file name="Qt5Network.dll"/>
+ <file name="Qt5Positioning.dll"/>
+ <file name="Qt5PrintSupport.dll"/>
+ <file name="Qt5Qml.dll"/>
+ <file name="Qt5QmlModels.dll"/>
+ <file name="Qt5QmlWorkerScript.dll"/>
+ <file name="Qt5Quick.dll"/>
+ <file name="Qt5QuickWidgets.dll"/>
+ <file name="Qt5SerialPort.dll"/>
+ <file name="Qt5Svg.dll"/>
+ <file name="Qt5WebChannel.dll"/>
+ <file name="Qt5WebEngineCore.dll"/>
+ <file name="Qt5WebEngineWidgets.dll"/>
+ <file name="Qt5WebSockets.dll"/>
+ <file name="Qt5Widgets.dll"/>
+ <file name="Qt5WinExtras.dll"/>
+</assembly>
diff --git a/src/env.cpp b/src/env.cpp
index 2862aa95..4e5ad196 100644
--- a/src/env.cpp
+++ b/src/env.cpp
@@ -394,6 +394,13 @@ QString path()
return get("PATH");
}
+QString prependToPath(const QString& s)
+{
+ auto old = path();
+ set("PATH", s + ";" + old);
+ return old;
+}
+
QString addPath(const QString& s)
{
auto old = path();
diff --git a/src/env.h b/src/env.h
index 5c7492c6..954c7bb0 100644
--- a/src/env.h
+++ b/src/env.h
@@ -236,6 +236,7 @@ QString get(const QString& name);
QString set(const QString& name, const QString& value);
QString path();
+QString prependToPath(const QString& s);
QString addPath(const QString& s);
QString setPath(const QString& s);
diff --git a/src/main.cpp b/src/main.cpp
index a81ae962..60b06817 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -464,69 +464,6 @@ MOBase::IPluginGame *determineCurrentGame(
return nullptr;
}
-
-// extend path to include dll directory so plugins don't need a manifest
-// (using AddDllDirectory would be an alternative to this but it seems fairly
-// complicated esp.
-// since it isn't easily accessible on Windows < 8
-// SetDllDirectory replaces other search directories and this seems to
-// propagate to child processes)
-void setupPath()
-{
- static const int BUFSIZE = 4096;
-
- QCoreApplication::setLibraryPaths(QStringList(QCoreApplication::applicationDirPath() + "/dlls") + QCoreApplication::libraryPaths());
-
- boost::scoped_array<TCHAR> oldPath(new TCHAR[BUFSIZE]);
- DWORD offset = ::GetEnvironmentVariable(TEXT("PATH"), oldPath.get(), BUFSIZE);
- if (offset > BUFSIZE) {
- oldPath.reset(new TCHAR[offset]);
- ::GetEnvironmentVariable(TEXT("PATH"), oldPath.get(), offset);
- }
-
- std::wstring newPath(ToWString(QDir::toNativeSeparators(
- QCoreApplication::applicationDirPath())) + L"\\dlls");
- newPath += L";";
- newPath += oldPath.get();
-
- ::SetEnvironmentVariableW(L"PATH", newPath.c_str());
-}
-
-void preloadDll(const QString& filename)
-{
- if (GetModuleHandleW(filename.toStdWString().c_str())) {
- // already loaded, this can happen when "restarting" MO by switching
- // instances, for example
- return;
- }
-
- const auto appPath = QDir::toNativeSeparators(
- QCoreApplication::applicationDirPath());
-
- const auto dllPath = appPath + "\\" + filename;
-
- if (!QFile::exists(dllPath)) {
- log::warn("{} not found", dllPath);
- return;
- }
-
- if (!LoadLibraryW(dllPath.toStdWString().c_str())) {
- const auto e = GetLastError();
- log::warn("failed to load {}: {}", dllPath, formatSystemMessage(e));
- }
-}
-
-void preloadSsl()
-{
-#if Q_PROCESSOR_WORDSIZE == 8
- preloadDll("libcrypto-1_1-x64.dll");
- preloadDll("libssl-1_1-x64.dll");
-#elif Q_PROCESSOR_WORDSIZE == 4
- preloadDll("libcrypto-1_1.dll");
- preloadDll("libssl-1_1.dll");
-#endif
-}
-
static QString getVersionDisplayString()
{
return createVersionInfo().displayString(3);
@@ -543,7 +480,6 @@ int runApplication(MOApplication &application, SingleInstance &instance,
getVersionDisplayString(), GITID, QCoreApplication::applicationDirPath(),
MOShared::getUsvfsVersionString());
- preloadSsl();
if (!QSslSocket::supportsSsl()) {
log::warn("no ssl support");
}
@@ -889,6 +825,25 @@ void initLogging()
qInstallMessageHandler(qtLogCallback);
}
+void preloadDll(const QString& filename)
+{
+ if (GetModuleHandleW(filename.toStdWString().c_str()))
+ return;
+
+ const auto appPath = QDir::toNativeSeparators(QDir::currentPath());
+ const auto dllPath = appPath + "\\dlls\\" + filename;
+
+ if (!QFile::exists(dllPath)) {
+ log::warn("{} not found", dllPath);
+ return;
+ }
+
+ if (!LoadLibraryW(dllPath.toStdWString().c_str())) {
+ const auto e = GetLastError();
+ log::warn("failed to load {}: {}", dllPath, formatSystemMessage(e));
+ }
+}
+
int main(int argc, char *argv[])
{
@@ -905,6 +860,9 @@ int main(int argc, char *argv[])
}
}
+ preloadDll("libcrypto-1_1-x64.dll");
+ preloadDll("libssl-1_1-x64.dll");
+
initLogging();
//Make sure the configured temp folder exists
@@ -925,9 +883,10 @@ int main(int argc, char *argv[])
MOApplication application(argc, argv);
QStringList arguments = application.arguments();
- SetThisThreadName("main");
+ env::prependToPath(QDir::toNativeSeparators(
+ QCoreApplication::applicationDirPath() + "/dlls"));
- setupPath();
+ SetThisThreadName("main");
bool forcePrimary = false;
if (arguments.contains("update")) {
diff --git a/src/qt.conf b/src/qt.conf
index f834a22a..d5a3f6ac 100644
--- a/src/qt.conf
+++ b/src/qt.conf
@@ -1,3 +1,7 @@
[Paths]
-Prefix=.
-Plugins=dlls
+Prefix=dlls
+Libraries=.
+LibraryExecutables=.
+Plugins=QtPlugins
+Imports=QtImports
+Qml2Imports=QtImports \ No newline at end of file