Here you can find the source of normalizePath(String path, String oldFileSeperator, String newFileSeparator)
public static String normalizePath(String path, String oldFileSeperator, String newFileSeparator)
//package com.java2s; //License from project: Apache License public class Main { public static String normalizePath(String path) { String fileSeparator = System.getProperty("file.separator"); String newPath = null;//from w w w .j a v a 2 s .com if (fileSeparator.equals("\\")) newPath = normalizePath(path, "/", fileSeparator); else newPath = normalizePath(path, "\\", "/"); if (newPath.contains(fileSeparator + fileSeparator)) newPath = newPath.replace(fileSeparator + fileSeparator, fileSeparator); return newPath; } public static String normalizePath(String path, String oldFileSeperator, String newFileSeparator) { boolean containsDrive = path.contains(":"); String newPath = path.replace(oldFileSeperator, newFileSeparator); if (containsDrive) { if (newPath.substring(0, 1).equals(newFileSeparator)) newPath = newPath.substring(1); } return newPath; } }