[Cmake-commits] [cmake-commits] king committed SystemTools.cxx 1.236 1.237
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Apr 15 13:03:35 EDT 2009
Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv7700/Source/kwsys
Modified Files:
SystemTools.cxx
Log Message:
BUG: Replace brittle GetParentDirectory impl
The previous change to this method broke cases where the input path does
not exist. The SystemTools::GetParentDirectory method is redundant with
the more robust SystemTools::GetFilenamePath. This replaces its
implementation to just call GetFilenamePath.
Index: SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.236
retrieving revision 1.237
diff -C 2 -d -r1.236 -r1.237
*** SystemTools.cxx 15 Apr 2009 14:45:29 -0000 1.236
--- SystemTools.cxx 15 Apr 2009 17:03:33 -0000 1.237
***************
*** 3976,4004 ****
kwsys_stl::string SystemTools::GetParentDirectory(const char* fileOrDir)
{
! if ( !fileOrDir || !*fileOrDir || !SystemTools::FileExists(fileOrDir))
! {
! return "";
! }
! kwsys_stl::string res = fileOrDir;
! SystemTools::ConvertToUnixSlashes(res);
!
! // If the root "/" directory is passed in, return empty string
! if(strcmp(res.c_str(), "/") ==0 )
! {
! return "";
! }
! kwsys_stl::string::size_type cc = res.size()-1;
! if ( res[cc] == '/' )
! {
! cc --;
! }
! for ( ; cc > 0; cc -- )
! {
! if ( res[cc] == '/' )
! {
! break;
! }
! }
! return res.substr(0, cc);
}
--- 3976,3980 ----
kwsys_stl::string SystemTools::GetParentDirectory(const char* fileOrDir)
{
! return SystemTools::GetFilenamePath(fileOrDir);
}
More information about the Cmake-commits
mailing list