Don't search installation prefix if binary is not found
authorRoland Schulz <roland@utk.edu>
Wed, 18 Feb 2015 05:50:21 +0000 (00:50 -0500)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Mon, 2 Mar 2015 13:10:12 +0000 (14:10 +0100)
It is possible that the binary isn't accessible (e.g. Cray launcher) and it
is not valid to call isEquivalent if the path is invalid.

Change-Id: Idf82a8c951fdc91a2de15d310843d54961ba74eb

src/gromacs/commandline/cmdlineprogramcontext.cpp

index 9368e3c9251bbd8728ceefc4784a0c64588f5373..084646698075d800cde85b2baf79ac1358f974b0 100644 (file)
@@ -243,9 +243,8 @@ std::string findInstallationPrefixPath(const std::string &binaryPath,
                                        bool              *bSourceLayout)
 {
     *bSourceLayout = false;
-    // If the input path is not absolute, the binary could not be found.
-    // Don't search anything.
-    if (Path::isAbsolute(binaryPath))
+    // Don't search anything if binary cannot be found.
+    if (Path::exists(binaryPath))
     {
         // Remove the executable name.
         std::string searchPath = Path::getParentPath(binaryPath);