diff options
| author | Tannin <devnull@localhost> | 2013-05-10 11:00:09 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-05-10 11:00:09 +0200 |
| commit | fc3753dcc5b7d55bf99674e7d17962f477053921 (patch) | |
| tree | 54fef6cd5b57533fd84f04cc58259c242600efed /src/main.cpp | |
| parent | 4fbfc9aa54ed4499f54eb7b3cd942337f6b49e58 (diff) | |
| parent | 9bc123e8e2dbd17508a68e4afc2eb881873601bd (diff) | |
Merge
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index 268bb98f..ab740467 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -64,6 +64,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <QDesktopServices> #include <eh.h> #include <windows_error.h> +#include <boost/scoped_array.hpp> #pragma comment(linker, "/manifestDependency:\"name='dlls' processorArchitecture='x86' version='1.0.0.0' type='win32' \"") @@ -284,6 +285,24 @@ int main(int argc, char *argv[]) QSplashScreen splash(pixmap); splash.show(); + { // extend path to include dll directory so plugins don't need a manifest + static const int BUFSIZE = 4096; + + 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::tstring newPath(oldPath.get()); + newPath += TEXT(";"); + newPath += ToWString(QDir::toNativeSeparators(QCoreApplication::applicationDirPath())).c_str(); + newPath += TEXT("\\dlls"); + + ::SetEnvironmentVariable(TEXT("PATH"), newPath.c_str()); + } + registerMetaTypes(); QStringList arguments = application.arguments(); |
