BUG: Fix Bug #9975 when softlinks are used.

This commit is contained in:
Clinton Stimpson 2010-05-05 06:48:30 -06:00
parent 0bf998a46b
commit 1df3f58317

View File

@ -11,7 +11,6 @@
============================================================================*/ ============================================================================*/
#include "QCMake.h" // include to disable MS warnings #include "QCMake.h" // include to disable MS warnings
#include <QApplication> #include <QApplication>
#include <QFileInfo>
#include <QDir> #include <QDir>
#include <QTranslator> #include <QTranslator>
#include <QLocale> #include <QLocale>
@ -21,6 +20,7 @@
#include "cmake.h" #include "cmake.h"
#include "cmVersion.h" #include "cmVersion.h"
#include <cmsys/CommandLineArguments.hxx> #include <cmsys/CommandLineArguments.hxx>
#include <cmsys/SystemTools.hxx>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static const char * cmDocumentationName[][3] = static const char * cmDocumentationName[][3] =
@ -164,16 +164,19 @@ int main(int argc, char** argv)
QStringList args = app.arguments(); QStringList args = app.arguments();
if(args.count() == 2) if(args.count() == 2)
{ {
QFileInfo buildFileInfo(args[1], "CMakeCache.txt"); cmsys_stl::string filePath = cmSystemTools::CollapseFullPath("..");
QFileInfo srcFileInfo(args[1], "CMakeLists.txt"); cmsys_stl::string buildFilePath =
if(buildFileInfo.exists()) cmSystemTools::CollapseFullPath("CMakeCache.txt", filePath.c_str());
cmsys_stl::string srcFilePath =
cmSystemTools::CollapseFullPath("CMakeLists.txt", filePath.c_str());
if(cmSystemTools::FileExists(buildFilePath.c_str()))
{ {
dialog.setBinaryDirectory(buildFileInfo.absolutePath()); dialog.setBinaryDirectory(filePath.c_str());
} }
else if(srcFileInfo.exists()) else if(cmSystemTools::FileExists(srcFilePath.c_str()))
{ {
dialog.setSourceDirectory(srcFileInfo.absolutePath()); dialog.setSourceDirectory(filePath.c_str());
dialog.setBinaryDirectory(QDir::currentPath()); dialog.setBinaryDirectory(cmSystemTools::CollapseFullPath(".").c_str());
} }
} }
} }