summaryrefslogtreecommitdiffstats
path: root/Source/cmGetFilenameComponentCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-07-23 12:10:02 (GMT)
committerBrad King <brad.king@kitware.com>2009-07-23 12:10:02 (GMT)
commitf10c25816761c8e4f9bddf85c76a2022ff9730f9 (patch)
treecdfb429511c3e7e3ecd1480f6fdda61a52af1bcc /Source/cmGetFilenameComponentCommand.cxx
parentf5ce03ed5952b51ca8c93baee3e37223064e1f70 (diff)
downloadCMake-f10c25816761c8e4f9bddf85c76a2022ff9730f9.zip
CMake-f10c25816761c8e4f9bddf85c76a2022ff9730f9.tar.gz
CMake-f10c25816761c8e4f9bddf85c76a2022ff9730f9.tar.bz2
BUG: Fix get_filename_component ABSOLUTE mode
This teaches the command to recognize full windows paths when built on UNIX. CollapseFullPath knows when the input path is relative better than FileIsFullPath because the latter is only meant for paths from the host platform.
Diffstat (limited to 'Source/cmGetFilenameComponentCommand.cxx')
-rw-r--r--Source/cmGetFilenameComponentCommand.cxx16
1 files changed, 3 insertions, 13 deletions
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx
index 8502e57..091b065 100644
--- a/Source/cmGetFilenameComponentCommand.cxx
+++ b/Source/cmGetFilenameComponentCommand.cxx
@@ -78,21 +78,11 @@ bool cmGetFilenameComponentCommand
else if (args[2] == "ABSOLUTE" ||
args[2] == "REALPATH")
{
+ // Collapse the path to its simplest form.
// If the path given is relative evaluate it relative to the
// current source directory.
- if(!cmSystemTools::FileIsFullPath(filename.c_str()))
- {
- std::string fname = this->Makefile->GetCurrentDirectory();
- if(!fname.empty())
- {
- fname += "/";
- fname += filename;
- filename = fname;
- }
- }
-
- // Collapse the path to its simplest form.
- result = cmSystemTools::CollapseFullPath(filename.c_str());
+ result = cmSystemTools::CollapseFullPath(
+ filename.c_str(), this->Makefile->GetCurrentDirectory());
if(args[2] == "REALPATH")
{
// Resolve symlinks if possible