convert Path to String, absolutize, ensure that separator is '/'.
493863
static String path2absoluteSlashSeparatedString(final Path path) {
        final String pathAsAStringBefore = path.toString();
        String pathAsAStringAfter = pathAsAStringBefore;
        String separator = FileSystems.getDefault().getSeparator();
        if ( pathAsAStringAfter != null
             &&
             ( pathAsAStringAfter.length() == 0
               ||
               !(
                  pathAsAStringAfter.startsWith("\\") ||
                  pathAsAStringAfter.startsWith("/")
               )
             )
           ) {
            pathAsAStringAfter = separator + pathAsAStringAfter;
        }
        // why M$ Windows ? why ?
        if (separator.equals("\\")) {
            pathAsAStringAfter = pathAsAStringAfter.replaceAll("\\\\", "/");
        }

        if (pathAsAStringBefore.equals(pathAsAStringAfter)) {
            log.trace("Path parameter '{}' transformed to '{}'", pathAsAStringBefore, pathAsAStringAfter);
        }

        return pathAsAStringAfter;
    }
1142076
private static String getTrimmedPath(String path) {
        String result = path;
        if (result.endsWith("/")) {
            result = result.substring(0, result.length() - 1);
        }
        return result;
    }
644627
def parse_path(path):
  """"""
  if not path:
    raise ValueError("Invalid path")

  if isinstance(path, str):
    if path == "/":
      raise ValueError("Invalid path")
    if path[0] != "/":
      raise ValueError("Invalid path")
    return path.split(_PATH_SEP)[1:]
  elif isinstance(path, (tuple, list)):
    return path
  else:
    raise ValueError("A path must be a string, tuple or list")
487499
function normalizePath (path) {
		// Remove double slashes
		if (path.indexOf('//') !== -1) {
			path = path.replace(/\/+/g, '/');
		}

		// Shift slash
		if (path[0] === '/') {
			path = path.substr(1);
		}
		
		// Pop slash
		if (path[path.length - 1] === '/') {
			path = path.substr(0, path.length - 1);
		}

		return path;
	}
232567
private String normalizeFilePath(final String path) {
        String normalizedPath = path.replace('\\', '/');

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

        return normalizedPath;
    }
1088012
public static String normalizePath(String path, String separator) {
    return path.endsWith(separator) ? path : path + separator;
  }
1148590
def _path_pair(self, s):
        """"""
        # TODO: handle a space in the first path
        if s.startswith(b'"'):
            parts = s[1:].split(b'" ', 1)
        else:
            parts = s.split(b' ', 1)
        if len(parts) != 2:
            self.abort(errors.BadFormat, '?', '?', s)
        elif parts[1].startswith(b'"') and parts[1].endswith(b'"'):
            parts[1] = parts[1][1:-1]
        elif parts[1].startswith(b'"') or parts[1].endswith(b'"'):
            self.abort(errors.BadFormat, '?', '?', s)
        return [_unquote_c_string(s) for s in parts]
382049
def consume_path_sep(self, i):
        """"""

        try:
            if self.bslash_abort:
                count = -1
                c = '\\'
                while c == '\\':
                    count += 1
                    c = next(i)
                i.rewind(1)
                # Rewind one more if we have an odd number (escape): \\\*
                if count > 0 and count % 2:
                    i.rewind(1)
            else:
                c = '/'
                while c == '/':
                    c = next(i)
                i.rewind(1)
        except StopIteration:
            pass
700984
public static String cleanPath(String path) {
        if (path.endsWith(SEPARATOR)) {
            path = path.replaceAll(SEPARATOR + "+$", "");
        }
        if (path.startsWith(SEPARATOR)) {
            path = path.replaceAll("^" + SEPARATOR + "+", "");
        }
        return path.replaceAll("/+", SEPARATOR);
    }
419072
private static String formatPathToFile(Path path) {
    return StringUtils.removeEnd(path.toString(), Path.SEPARATOR);
  }
509854
function normalizeSeparators (p) {
  p = p || "";

  if (path.sep === "\\") {
    // Replace backslashes with forward slashes
    return p.replace(/\\/g, "/");
  }
  else {
    // Return the path as-is, since it should already have proper URL separators.
    // If it DOES contain backslashes, then they are treated as normal characters,
    // NOT as separators
    return p;
  }
}
1212100
def os_path_transform(self, s, sep=os.path.sep):
        
        if sep == '/':
            return s
        else:
            return s.replace(sep, '/')
980641
def absolute_path(string):
    ''''''
    if not os.path.isabs(string):
        msg = '{0!r} is not an absolute path'.format(string)
        raise argparse.ArgumentTypeError(msg)
    if not os.path.exists(os.path.dirname(string)):
        msg = 'path {0!r} does not exist'.format(string)
        raise argparse.ArgumentTypeError(msg)
    return string
1164949
def showpath(path):
    """"""
    if logger.verbose:
        return os.path.abspath(path)
    else:
        path = os.path.relpath(path)
        if path.startswith(os.curdir + os.sep):
            path = path[len(os.curdir + os.sep):]
        return path
66783
def splitPath( self, path ):
        
        sep = self.model().separator()
        splt = nativestring(path).lstrip(sep).split(sep)
        
        if ( splt and not splt[-1] ):
            self.model().itemByPath(path)
            
        return splt
818334
def path_to_parts(path)
      path.
        downcase.
        split('/').
        map { |part| part.empty? ? nil : part.strip }.
        compact
    end
1195391
def splitparams (path):
    
    if '/' in path:
        i = path.find(';', path.rfind('/'))
    else:
        i = path.find(';')
    if i < 0:
        return path, ''
    return path[:i], path[i+1:]