diff options
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index d0aedd9..23da1e3 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1104,7 +1104,8 @@ std::string cmSystemTools::FileExistsInParentDirectories(const char* fname, SystemTools::ConvertToUnixSlashes(file); std::string dir = directory; SystemTools::ConvertToUnixSlashes(dir); - while ( !dir.empty() ) + std::string prevDir; + while(dir != prevDir) { std::string path = dir + "/" + file; if ( SystemTools::FileExists(path.c_str()) ) @@ -1115,6 +1116,7 @@ std::string cmSystemTools::FileExistsInParentDirectories(const char* fname, { break; } + prevDir = dir; dir = SystemTools::GetParentDirectory(dir.c_str()); } return ""; |