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.
This commit is contained in:
parent
f5ce03ed59
commit
f10c258167
|
@ -78,21 +78,11 @@ bool cmGetFilenameComponentCommand
|
||||||
else if (args[2] == "ABSOLUTE" ||
|
else if (args[2] == "ABSOLUTE" ||
|
||||||
args[2] == "REALPATH")
|
args[2] == "REALPATH")
|
||||||
{
|
{
|
||||||
|
// Collapse the path to its simplest form.
|
||||||
// If the path given is relative evaluate it relative to the
|
// If the path given is relative evaluate it relative to the
|
||||||
// current source directory.
|
// current source directory.
|
||||||
if(!cmSystemTools::FileIsFullPath(filename.c_str()))
|
result = cmSystemTools::CollapseFullPath(
|
||||||
{
|
filename.c_str(), this->Makefile->GetCurrentDirectory());
|
||||||
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());
|
|
||||||
if(args[2] == "REALPATH")
|
if(args[2] == "REALPATH")
|
||||||
{
|
{
|
||||||
// Resolve symlinks if possible
|
// Resolve symlinks if possible
|
||||||
|
|
Loading…
Reference in New Issue