From 22c429a1a7a1095effcc45a3400aa5f15a810152 Mon Sep 17 00:00:00 2001 From: Andre Bernet Date: Sat, 31 Oct 2015 10:17:43 +0400 Subject: [PATCH] Also search for simulators in companion.exe path on Windows (Fix #3012) --- companion/src/simulation/simulatorinterface.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/companion/src/simulation/simulatorinterface.cpp b/companion/src/simulation/simulatorinterface.cpp index 6a0034a58..abf666afe 100644 --- a/companion/src/simulation/simulatorinterface.cpp +++ b/companion/src/simulation/simulatorinterface.cpp @@ -6,6 +6,9 @@ #include #include #include "version.h" +#if defined WIN32 || !defined __GNUC__ + #include +#endif QMap registered_simulators; @@ -47,10 +50,15 @@ void registerSimulators() simulatorsFound = true; } -#if defined(__APPLE__) || !( (!defined __GNUC__) || (defined __CYGWIN__) ) if (!simulatorsFound) { #if defined(__APPLE__) dir = QLibraryInfo::location(QLibraryInfo::PrefixPath) + "/Resources"; +#elif (!defined __GNUC__) || (defined __CYGWIN__) + char name[MAX_PATH]; + GetModuleFileName(NULL, name, MAX_PATH); + QString path(name); + path.truncate(path.lastIndexOf('\\')); + dir.setPath(path); #else dir = SIMULATOR_LIB_SEARCH_PATH; #endif @@ -59,7 +67,6 @@ void registerSimulators() simulatorsFound = true; } } -#endif } SimulatorFactory *getSimulatorFactory(const QString &name)