Strips the prefix from a path.

    Args:
      path (str): Windows path to strip the prefix from.

    Returns:
      str: path without the prefix or None if the path is not supported.
194768
def _PathStripPrefix(self, path):
    
    if path.startswith('\\\\.\\') or path.startswith('\\\\?\\'):
      if len(path) < 7 or path[5] != ':' or path[6] != self._PATH_SEPARATOR:
        # Cannot handle a non-volume path.
        return None

      path = path[7:]

    elif path.startswith('\\\\'):
      # Cannot handle an UNC path.
      return None

    elif len(path) >= 3 and path[1] == ':':
      # Check if the path is a Volume 'absolute' path.
      if path[2] != self._PATH_SEPARATOR:
        # Cannot handle a Volume 'relative' path.
        return None

      path = path[3:]

    elif path.startswith('\\'):
      path = path[1:]

    else:
      # Cannot handle a relative path.
      return None

    return path
1221126
protected String stripFileSeparateAtTheEnd(String path) {
        return (path != null && (path.endsWith("/") || path.endsWith("\\") ) ) 
                ? path.substring(0, path.length()-1)
                : path;
    }
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
846388
def get_formatted_path(path):
        
        if path[0] != '/':
            path = '/' + path
        if path[-1] != '/':
            path = '{0}/'.format(path)
        return path
1136970
def remove_path(path):
    """"""
    if path is None or not os.path.exists(path):
        return
    if platform.system() == 'Windows':
        # Need to have write permission before deleting the file.
        os.chmod(path, stat.S_IWRITE)
    try:
        if os.path.isdir(path):
            shutil.rmtree(path)
        elif os.path.isfile(path):
            shutil.os.remove(path)
    except OSError:
        logger.exception("Could not remove path: %s" % path)
744030
def strip_required_prefix(string, prefix):
    
    if string.startswith(prefix):
        return string[len(prefix):]
    raise AssertionError('String starts with %r, not %r' % (string[:len(prefix)], prefix))
1070543
def remove_slug(path):
    
    if path.endswith('/'):
        path = path[:-1]
    if path.startswith('/'):
        path = path[1:]
    if "/" not in path or not path:
        return None
    parts = path.split("/")[:-1]
    return "/".join(parts)
1315729
def remove_from_pythonpath(self, path):
        """"""
        pathlist = self.get_pythonpath()
        if path in pathlist:
            pathlist.pop(pathlist.index(path))
            self.set_pythonpath(pathlist)
            return True
        else:
            return False
1229455
def fixPath(path):
  
  path = os.path.abspath(os.path.expanduser(path))
  if path.startswith("\\"):
    return "C:" + path

  return path
878159
public static String removeIndexFromPath(String path)
   {
      if (path.endsWith("]"))
      {
         int index = path.lastIndexOf('[');
         if (index != -1)
         {
            return path.substring(0, index);
         }
      }
      return path;
   }
215835
protected static String stripSuffix (String path)
    {
        if (path.endsWith(".jar")) {
            return path.substring(0, path.length()-4);
        } else {
            // we have to change the path somehow
            return path + "-cache";
        }
    }
1118481
def _prefix_is_authorized(self, path):
        
        path = os.path.abspath(path)
        while True:
            if path in self._prefixes:
                return True
            if path == '/':
                break
            path = os.path.dirname(path)
        return False
1122888
def unregister_path(self, path):
        

        if not path in self:
            raise umbra.exceptions.PathExistsError("{0} | '{1}' path isn't registered!".format(
                self.__class__.__name__, path))

        del (self.__paths[path])
        return True
1223899
def path_to_tuple(path, windows=False):
    
    if windows:
        path_tup = tuple(path.split('\\'))
    else:
        path_tup = tuple(path.split('/'))
    #
    # Normalize UTF-8 encoding to consistent form so cache lookups will work, see
    # https://docs.python.org/3.6/library/unicodedata.html#unicodedata.normalize
    path_tup = tuple(normalize('NFD', part) for part in path_tup)
    return path_tup
816515
public static String pathOnly(String path)
   {
      String curPath = path;
      curPath = curPath.substring(curPath.indexOf("/"));
      curPath = curPath.substring(0, curPath.lastIndexOf("/"));
      if ("".equals(curPath))
      {
         curPath = "/";
      }
      return curPath;
   }
1184427
def _StripCommonPathPrefix(paths):
  """"""
  # Find the longest common prefix in terms of characters.
  common_prefix = os.path.commonprefix(paths)
  # Truncate at last segment boundary. E.g. '/aa/bb1/x.py' and '/a/bb2/x.py'
  # have '/aa/bb' as the common prefix, but we should strip '/aa/' instead.
  # If there's no '/' found, returns -1+1=0.
  common_prefix_len = common_prefix.rfind('/') + 1
  return [path[common_prefix_len:] for path in paths]
1028827
function stripCommonPath(paths) {
  var prefix = commonPrefix(paths);
  var prefixLength = prefix.lastIndexOf('/') + 1;

  return paths.map(function(str) {
    return str.slice(prefixLength);
  });
}