diff --git a/SystemTools.cxx b/SystemTools.cxx
index 93c452780ef2aff29956496260693a0c4ca62fb5..7e6ab87b501aaa4e5c2a82f99e5515871795e048 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -3692,7 +3692,7 @@ kwsys_stl::string SystemTools::GetFilenameName(const kwsys_stl::string& filename
 #if defined(_WIN32)
   kwsys_stl::string::size_type slash_pos = filename.find_last_of("/\\");
 #else
-  kwsys_stl::string::size_type slash_pos = filename.find_last_of("/");
+  kwsys_stl::string::size_type slash_pos = filename.rfind('/');
 #endif
   if(slash_pos != kwsys_stl::string::npos)
     {