Returns the canonical Windows path for a given path. This means
basically replacing any forwards slashes with backslashes.

@param path  the path whose canonical form to return
967537
function getCanonicalPath(path) {
        path = path.replace(/\//g, '\\');
        path = path.replace(/\\\\/g, '\\');
        return path;
    }
176511
private String resolveRemotePath(String path) throws SftpStatusException {
		verifyConnection();

		String actual;
		if (!path.startsWith("/") && !path.startsWith(cwd)
				&& !isWindowsRoot(path) && !startsWithCustomRoot(path)) {
			actual = cwd + (cwd.endsWith("/") ? "" : "/") + path;
		} else {
			actual = path;
		}

		if (!actual.equals("/") && actual.endsWith("/")) {
			return actual.substring(0, actual.length() - 1);
		} else {
			return actual;
		}
	}
694753
def escapePathForShell(path):
		
		if platform.system() == 'Windows':
			return '"{}"'.format(path.replace('"', '""'))
		else:
			return shellescape.quote(path)
698319
private static String convertFromWindowsPath(String path)
  {
    int colon = path.indexOf(':');
    int length = path.length();
    char ch;

    if (colon == 1 && (ch = path.charAt(0)) != '/' && ch != '\\')
      return "/" + path.charAt(0) + ":/" + path.substring(2);
    else if (length > 1
             && ((ch = path.charAt(0)) == '/' || ch == '\\')
             && ((ch = path.charAt(1)) == '/' || ch == '\\')) {
      if (colon < 0)
        return "/:" + path;

      for (int i = colon - 2; i > 1; i--) {
        if ((ch = path.charAt(i)) != '/' && ch != '\\')
          return "/:" + path;
      }

      ch = path.charAt(colon - 1);

      if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z')
        return path.substring(colon - 2);
      else
        return "/:" + path;
    }
    else
      return path;
  }
633030
public static String optionallyRemovePrecedingSlash(final String path) {
        // Precondition check
        assertSpecified(path);

        // Is there's a first character of slash
        if (isFirstCharSlash(path)) {
            // Return everything but first char
            return path.substring(1);
        }

        // Return as-is
        return path;
    }
175160
public static String normalizeResourcePath(final String path) {
		if (path == null) {
			return null;
		}
		String normalizedPath = replaceSlashes(path.trim());
		if (normalizedPath.startsWith("/") && normalizedPath.length() > 1) {
			normalizedPath = normalizedPath.substring(1);
		}
		return normalizedPath;
	}
955158
private String getClassNameFromPath(String path) {
        String className = path.replace(".class", "");

        // for *nix
        if (className.startsWith("/")) {
            className = className.substring(1, className.length());
        }
        className = className.replace("/", ".");

        // for windows
        if (className.startsWith("\\")) {
            className = className.substring(1, className.length());
        }
        className = className.replace("\\", ".");

        return className;
    }
1346676
function getNameFromPath (path) {
  path = _(path).toString();
  let lastSlash = path.substring(0, path.length - 1).lastIndexOf("/");
  if (lastSlash === -1) {
    return normalizeName(path);
  }
  else {
    return normalizeName(path.substring(lastSlash));
  }
}
767027
public static String createFolderPath(String path) {

        String[] pathParts = path.split("\\.");
        String path2 = "";
        for (String part : pathParts) {
            if (path2.equals("")) {
                path2 = part;
            } else {
                path2 = path2 + File.separator
                        + changeFirstLetterToLowerCase(createClassName(part));
            }
        }

        return path2;
    }
314454
def path_with_slashes(path)
      path = '/' + path unless path.start_with?('/')
      path << '/' unless path.end_with?('/')
      path
    end
1337677
public static String separatorsToSystem(final String path) {
        if (path == null) {
            return null;
        }
        if (IOUtil.IS_OS_WINDOWS) {
            return separatorsToWindows(path);
        } else {
            return separatorsToUnix(path);
        }
    }
23991
protected String normalizePath(String path) {

        if (path.equals("/")) {
            return path;
        } else {
            return CmsFileUtil.removeTrailingSeparator(path);
        }

    }
237572
public static String dirname(String path)
    {
        int index = path.lastIndexOf('/');
        if (index == -1) return path;
        return path.substring(0, index + 1);
    }
786986
public static String separatorsToSystem(String path) {
		if (path == null) {
			return null;
		}
		if (EnvUtil.isWindows()) {
			return separatorsToWindows(path);
		} else {
			return separatorsToUnix(path);
		}
	}
890409
public static String normalizePath(String path) {
        requireNonNull(path, "path");
        if (path.isEmpty()) {
            return "/";
        }

        if (!path.startsWith("/")) {
            path = '/' + path;
        }

        if (!path.endsWith("/")) {
            path += '/';
        }

        return path.replaceAll("//+", "/");
    }
126851
def proper_path(path):
    
    if path.startswith("./"):
        pass
    elif path.startswith("/"):
        path = ".%s" % path
    elif path.startswith("."):
        while path.startswith("."):
            path = path[1:]
        if path.startswith("/"):
            path = ".%s" % path
    else:
        path = "./%s" % path

    if not path.endswith("/"):
        path += "/"

    return path
1320339
public static String separatorsToSystem(final String path)
    {
        if (path == null)
        {
            return null;
        }
        if (isSystemWindows())
        {
            return separatorsToWindows(path);
        }
        else
        {
            return separatorsToUnix(path);
        }
    }