From 461aa5c1f907c252c46bacd5f00021eeaefab75f Mon Sep 17 00:00:00 2001 From: kelson42 Date: Thu, 29 May 2014 22:52:11 +0200 Subject: [PATCH] + kiwix-launcher able to launch system xulrunner binary --- src/launcher/kiwix-launcher.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/launcher/kiwix-launcher.cpp b/src/launcher/kiwix-launcher.cpp index c5f9cb6..4d19736 100644 --- a/src/launcher/kiwix-launcher.cpp +++ b/src/launcher/kiwix-launcher.cpp @@ -98,17 +98,29 @@ int main(int argc, char *argv[]) { } /* Find xulrunner (binary) path */ + std::vector xulrunnerPossibleNames; + xulrunnerPossibleNames.push_back(std::string("xulrunner") + std::string(EXEXT)); + xulrunnerPossibleNames.push_back(std::string("xulrunner-bin") + std::string(EXEXT)); + xulrunnerPossibleNames.push_back(std::string("xulrunner-") + std::string(GECKO_VERSION)); + xulrunnerPossibleNames.push_back(std::string("xulrunner-") + std::string(GECKO_VERSION) + + std::string(".0")); + xulrunnerPossibleNames.push_back(std::string("xulrunner-") + std::string(MAJOR_GECKO_VERSION)); + xulrunnerPossibleNames.push_back(std::string("xulrunner-") + std::string(MINOR_GECKO_VERSION)); + + std::vector::iterator filesIt; string xulrunnerPath; directoriesIt = xulrunnerPossibleDirectories.begin(); while (xulrunnerPath.empty() && directoriesIt != xulrunnerPossibleDirectories.end()) { if (fileExists(*directoriesIt)) { - xulrunnerPath = computeAbsolutePath(*directoriesIt, std::string("xulrunner-bin") + std::string(EXEXT)); - if (!fileExists(xulrunnerPath)) { - xulrunnerPath = computeAbsolutePath(*directoriesIt, std::string("xulrunner") + std::string(EXEXT)); + filesIt = xulrunnerPossibleNames.begin(); + while (xulrunnerPath.empty() && + filesIt != xulrunnerPossibleNames.end()) { + xulrunnerPath = computeAbsolutePath(*directoriesIt, *filesIt); if (!fileExists(xulrunnerPath)) { xulrunnerPath.clear(); } - } + filesIt++; + }; } directoriesIt++; } @@ -134,7 +146,7 @@ int main(int argc, char *argv[]) { "kiwix-windows/application.ini")); string applicationIniPath; - std::vector::iterator filesIt = applicationIniPossiblePaths.begin(); + filesIt = applicationIniPossiblePaths.begin(); while (applicationIniPath.empty() && filesIt != applicationIniPossiblePaths.end()) { if (fileExists(*filesIt)) {