Prefix a path with the OS path separator if it is not already
766601
def pfx_path(path):
    
    if path[0] != os.path.sep: return os.path.sep + path
    else:                      return path
335762
def change_path_prefix(self, path, old_prefix, new_prefix, app_name):
        """"""
        relative_path = os.path.relpath(path, old_prefix)
        return os.path.join(new_prefix, app_name, relative_path)
1151343
def create_prefix_dir(self, path, fmt):
        """"""
        create_prefix_dir(self._get_os_path(path.strip('/')), fmt)
884035
def existing_path(string):
    ''''''
    if not os.path.exists(string):
        msg = 'path {0!r} does not exist'.format(string)
        raise argparse.ArgumentTypeError(msg)
    return string
744563
def hard_path(path, prefix_dir):
    """"""
    relative = abspath("%s/%s" % (prefix_dir, path))
    a_path = abspath(path)
    if os.path.exists(relative):
        LOG.debug("using relative path %s (%s)", relative, path)
        return relative

    LOG.debug("using absolute path %s", a_path)
    return a_path
756142
def fix_path(path):
    
    if '\\' in path:
        path = path.replace('\\', '/')

    path = os.path.normpath(path)

    return path
86733
def -(other)
      other = other.to_key_path
      raise KeyError unless prefix?(other)

      super(other.length)
    end
976071
def resolve_frompath(pkgpath, relpath, level=0):
    """"""
    if level == 0:
        return relpath
    parts = pkgpath.split('.') + ['_']
    parts = parts[:-level] + (relpath.split('.') if relpath else [])
    return '.'.join(parts)
593377
def abbreviate_paths(pathspec,named_paths):
    
    from os.path import commonprefix, dirname, sep

    prefix = commonprefix([dirname(name)+sep for name in named_paths.keys()]+[pathspec])
    return OrderedDict([(name[len(prefix):],path) for name,path in named_paths.items()])
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
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
1353385
function (root_path, default_prefix) {
		var arr = SR.Settings.SR_PATH.split(SR.path.sep);
		var prefix = arr[arr.length-1] + '-';
		var dirs = UTIL.getDirectoriesSync(root_path);

		if (default_prefix)
			prefix = default_prefix;
		
		//LOG.warn('default_prefix: ' + default_prefix + ' prefix: ' + prefix + ' paths to check:');
		for (var i in dirs) {
			//LOG.warn(dirs[i]);
			if (dirs[i].startsWith(prefix)) { 
				SR.Settings.MOD_PATHS.push(SR.path.resolve(root_path, dirs[i]));
			}
		}
	}
844474
def abspath(*path):
    """"""
    setup_dir = os.path.dirname(os.path.abspath(__file__))
    return os.path.join(setup_dir, *path)
1177528
def __get_posix_path(self):
        """"""
        if os_sep_is_slash:
            return self
        else:
            entry = self.get()
            r = entry.get_path().replace(OS_SEP, '/')
            return SCons.Subst.SpecialAttrWrapper(r, entry.name + "_posix")
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
311004
def check_path(path, otherwise):
    

    if os.path.exists(path):
        print("WARNING: Path '%s' already exists; skipping" % path)
    else:
        otherwise(path)
720969
function resolvePrefixAndFile (nonAbsoluteFilePath, prefix) {
  // prefix is not absolute
  if (path.parse(prefix).root === '') {
    return path.resolve(process.cwd(), prefix, nonAbsoluteFilePath)
  }

  // prefix is absolute
  return path.resolve(prefix, nonAbsoluteFilePath)
}