X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=common%2FclitkCommon.cxx;h=96980bbbb6b47f3c7c20106f0ef9dd0e2cabd09d;hb=5d27ea238f9a92605b0834bf5758b1d404026da5;hp=d1a14bf3fd44d379470c2daef007133e6079c6cd;hpb=09189117040bdb0c9d46a5132671567efea31632;p=clitk.git diff --git a/common/clitkCommon.cxx b/common/clitkCommon.cxx index d1a14bf..96980bb 100644 --- a/common/clitkCommon.cxx +++ b/common/clitkCommon.cxx @@ -19,6 +19,8 @@ #ifndef CLITKCOMMON_CXX #define CLITKCOMMON_CXX +#include + // clitk include #include "clitkCommon.h" @@ -75,9 +77,13 @@ std::string clitk::GetExtension(const std::string& filename) std::vector clitk::SplitFilename(const std::string& filename) { std::vector dirname; - std::size_t found = filename.find_last_of("/\\"); - dirname.push_back(filename.substr(0,found)); - dirname.push_back(filename.substr(found+1,found)); + std::string path = itksys::SystemTools::GetFilenamePath(filename); + std::vector pathComponents; + itksys::SystemTools::SplitPath(filename.c_str(), pathComponents); + std::string fileName = pathComponents.back(); + if (path != "") + dirname.push_back(path); + dirname.push_back(fileName); return( dirname ); } //// //------------------------------------------------------------------