Commits

Anonymous committed 8de8fb4

ENH: SplitPath now supports slashes in both directions in the input path but still produces forward slashes in the root component.

  • Participants
  • Parent commits c94f5a9
  • Tags KWSys-stl-string-io-pre

Comments (0)

Files changed (2)

File GCC_XML/KWSys/SystemTools.cxx

   components.clear();
   // Identify the root component.
   const char* c = p;
-  if(c[0] == '/' && c[1] == '/')
+  if((c[0] == '/' && c[1] == '/') || (c[0] == '\\' && c[1] == '\\'))
     {
     // Network path.
     components.push_back("//");
     components.push_back("/");
     c += 1;
     }
-  else if(c[0] && c[1] == ':' && c[2] == '/')
+  else if(c[0] && c[1] == ':' && (c[2] == '/' || c[2] == '\\'))
     {
     // Windows path.
     kwsys_stl::string root = "_:/";
   const char* last = first;
   for(;*last; ++last)
     {
-    if(*last == '/')
+    if(*last == '/' || *last == '\\')
       {
       // End of a component.  Save it.
       components.push_back(kwsys_stl::string(first, last-first));

File GCC_XML/KWSys/SystemTools.hxx.in

    * The remaining components form the path.  If there is a trailing
    * slash then the last component is the empty string.  The
    * components can be recombined as "c[0]c[1]/c[2]/.../c[n]" to
-   * produce the original path.  The input is assumed to be formatted
-   * with forward slashes.
+   * produce the original path.
    */
   static void SplitPath(const char* p,
                         kwsys_stl::vector<kwsys_stl::string>& components);