summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-11-07 16:31:35 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2020-11-07 20:16:26 -0500
commita8187e7dc47cd344fd309a2be3675e4687f95aaa (patch)
tree3e33e1b3f64208caaa97e6f00c542ce86c089797 /src/main.cpp
parent90ea45328d72f9664ace3cfbdce700dbe7a1d016 (diff)
moved dlls stuff to MOApplication
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp40
1 files changed, 1 insertions, 39 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 9d6ed7b0..a8ea2601 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -122,44 +122,6 @@ void setExceptionHandlers()
g_prevTerminateHandler = std::set_terminate(onTerminate);
}
-// This adds the `dlls` directory to the path so the dlls can be found. How
-// MO is able to find dlls in there is a bit convoluted:
-//
-// Dependencies on DLLs can be baked into an executable by passing a
-// `manifestdependency` option to the linker. This can be done on the command
-// line or with a pragma. Typically, the dependency will not be a hardcoded
-// filename, but an assembly name, such as Microsoft.Windows.Common-Controls.
-//
-// When Windows loads the exe, it will look for this assembly in a variety of
-// places, such as in the WinSxS folder, but also in the program's folder. It
-// will look for `assemblyname.dll` or `assemblyname/assemblyname.dll` and try
-// to load that.
-//
-// If these files don't exist, then the loader gets creative and looks for
-// `assemblyname.manifest` and `assemblyname/assemblyname.manifest`. A manifest
-// file is just an XML file that can contain a list of DLLs to load for this
-// assembly.
-//
-// In MO's case, there's a `pragma` at the beginning of this file which adds
-// `dlls` as an "assembly" dependency. This is a bit of a hack to just force
-// the loader to eventually find `dlls/dlls.manifest`, which contains the list
-// of all the DLLs MO requires to load.
-//
-// This file was handwritten in `modorganizer/src/dlls.manifest.qt5` and
-// is copied and renamed in CMakeLists.txt into `bin/dlls/dlls.manifest`. Note
-// that the useless and incorrect .qt5 extension is removed.
-//
-void addDllsToPath()
-{
- const auto dllsPath = QDir::toNativeSeparators(
- QCoreApplication::applicationDirPath() + "/dlls");
-
- QCoreApplication::setLibraryPaths(
- QStringList(dllsPath) + QCoreApplication::libraryPaths());
-
- env::prependToPath(dllsPath);
-}
-
std::optional<int> handleCommandLine(
const cl::CommandLine& cl, OrganizerCore& organizer)
{
@@ -646,8 +608,8 @@ int main(int argc, char *argv[])
SetThisThreadName("main");
initLogging();
+
auto application = MOApplication::create(argc, argv);
- addDllsToPath();
SingleInstance instance(cl.multiple());
if (instance.ephemeral()) {