[Cmake-commits] [cmake-commits] king committed cmGetFilenameComponentCommand.cxx 1.19 1.20 cmGetFilenameComponentCommand.h 1.15 1.16
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Feb 9 09:23:57 EST 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv31677/Source
Modified Files:
cmGetFilenameComponentCommand.cxx
cmGetFilenameComponentCommand.h
Log Message:
ENH: Add get_filename_component(... REALPATH)
This patch from Philip Lowman creates a REALPATH mode in the
get_filename_component command. It is like ABSOLUTE, but will also
resolve symlinks (which ABSOLUTE once did but was broken long ago).
See issue #8423.
Index: cmGetFilenameComponentCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGetFilenameComponentCommand.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C 2 -d -r1.15 -r1.16
*** cmGetFilenameComponentCommand.h 6 Feb 2009 13:33:52 -0000 1.15
--- cmGetFilenameComponentCommand.h 9 Feb 2009 14:23:55 -0000 1.16
***************
*** 69,77 ****
return
" get_filename_component(VarName FileName\n"
! " PATH|ABSOLUTE|NAME|EXT|NAME_WE\n"
" [CACHE])\n"
"Set VarName to be the path (PATH), file name (NAME), file "
"extension (EXT), file name without extension (NAME_WE) of FileName, "
! "or the full path (ABSOLUTE). "
"Note that the path is converted to Unix slashes format and has no "
"trailing slashes. The longest file extension is always considered. "
--- 69,78 ----
return
" get_filename_component(VarName FileName\n"
! " PATH|ABSOLUTE|NAME|EXT|NAME_WE|REALPATH\n"
" [CACHE])\n"
"Set VarName to be the path (PATH), file name (NAME), file "
"extension (EXT), file name without extension (NAME_WE) of FileName, "
! "the full path (ABSOLUTE), or the full path with all symlinks "
! "resolved (REALPATH). "
"Note that the path is converted to Unix slashes format and has no "
"trailing slashes. The longest file extension is always considered. "
Index: cmGetFilenameComponentCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGetFilenameComponentCommand.cxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -C 2 -d -r1.19 -r1.20
*** cmGetFilenameComponentCommand.cxx 6 Feb 2009 13:33:52 -0000 1.19
--- cmGetFilenameComponentCommand.cxx 9 Feb 2009 14:23:55 -0000 1.20
***************
*** 76,80 ****
result = cmSystemTools::GetFilenameWithoutExtension(filename);
}
! else if (args[2] == "ABSOLUTE")
{
// If the path given is relative evaluate it relative to the
--- 76,81 ----
result = cmSystemTools::GetFilenameWithoutExtension(filename);
}
! else if (args[2] == "ABSOLUTE" ||
! args[2] == "REALPATH")
{
// If the path given is relative evaluate it relative to the
***************
*** 93,96 ****
--- 94,102 ----
// Collapse the path to its simplest form.
result = cmSystemTools::CollapseFullPath(filename.c_str());
+ if(args[2] == "REALPATH")
+ {
+ // Resolve symlinks if possible
+ result = cmSystemTools::GetRealPath(filename.c_str());
+ }
}
else
More information about the Cmake-commits
mailing list