langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
changeset 14061 9ac68cf0048b
parent 13842 6908f6badce4
child 14258 8d2148961366
equal deleted inserted replaced
14060:ae69cea86e83 14061:9ac68cf0048b
   486             s.add(current);
   486             s.add(current);
   487         }
   487         }
   488     }
   488     }
   489 
   489 
   490     /**
   490     /**
   491      * Add a traliling file separator, if not found or strip off extra trailing
   491      * Add a trailing file separator, if not found. Remove superfluous
   492      * file separators if any.
   492      * file separators if any. Preserve the front double file separator for
       
   493      * UNC paths.
   493      *
   494      *
   494      * @param path Path under consideration.
   495      * @param path Path under consideration.
   495      * @return String Properly constructed path string.
   496      * @return String Properly constructed path string.
   496      */
   497      */
   497     String addTrailingFileSep(String path) {
   498     public static String addTrailingFileSep(String path) {
   498         String fs = System.getProperty("file.separator");
   499         String fs = System.getProperty("file.separator");
   499         String dblfs = fs + fs;
   500         String dblfs = fs + fs;
   500         int indexDblfs;
   501         int indexDblfs;
   501         while ((indexDblfs = path.indexOf(dblfs)) >= 0) {
   502         while ((indexDblfs = path.indexOf(dblfs, 1)) >= 0) {
   502             path = path.substring(0, indexDblfs) +
   503             path = path.substring(0, indexDblfs) +
   503                 path.substring(indexDblfs + fs.length());
   504                 path.substring(indexDblfs + fs.length());
   504         }
   505         }
   505         if (!path.endsWith(fs))
   506         if (!path.endsWith(fs))
   506             path += fs;
   507             path += fs;