/*\
|*| Expands paths with special meaning or relative paths into absolute paths.
\
346915
function expandPath(p) {
  if(p[0] === '~') {
    p = getUserHome() + p.slice(1);
  }
  return path.normalize(p);
}
1028827
function stripCommonPath(paths) {
  var prefix = commonPrefix(paths);
  var prefixLength = prefix.lastIndexOf('/') + 1;

  return paths.map(function(str) {
    return str.slice(prefixLength);
  });
}
301488
def _absolute_path(path, relative_to=None):
    '''
    
    '''

    if path and os.path.isabs(path):
        return path
    if path and relative_to is not None:
        _abspath = os.path.join(relative_to, path)
        if os.path.isfile(_abspath):
            log.debug(
                'Relative path \'%s\' converted to existing absolute path '
                '\'%s\'', path, _abspath
            )
            return _abspath
    return path
1287901
def path_expand(text):
    
    result = os.path.expandvars(os.path.expanduser(text))

    # template = Template(text)
    # result = template.substitute(os.environ)

    if result.startswith("."):
        result = result.replace(".", os.getcwd(), 1)

    return result
327814
def expand_filepath(filepath):
    
    return os.path.abspath(os.path.expandvars(os.path.expanduser(filepath)))
1076358
def abspath(self, path):
        '''
        
        '''
        if not path.startswith(os.path.sep) or path.startswith('~'):
            path = os.path.expanduser(os.path.join(self.base_path, path))
        return path
329193
function flattenPath(file, opts) {
  var fileName = path.basename(file.path);
  var dirs;

  if (!opts.includeParents && !opts.subPath) {
    return fileName;
  }

  dirs = path.dirname(file.relative).split(path.sep);
  if (opts.includeParents) {
    dirs = includeParents(dirs, opts.includeParents);
  }
  if (opts.subPath) {
    dirs = subPath(dirs, opts.subPath);
  }

  dirs.push(fileName);
  return path.join.apply(path, dirs);
}
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
1141071
function relative(dir, file) {
    var isDirectory = file.slice(-1) === '/';
    return normalize(path.relative(dir, file)) + (isDirectory? '/': '');
}
1051393
function normalizePath(dir) {
  if(dir && dir[dir.length - 1] != path.sep) {
    dir += path.sep;
  }
  return dir;
}
1184739
function normalizePath (path, basePath) {
  var joined = nodepath.join(basePath || '/', path || '');
  var normalized = nodepath.normalize(joined);

  return (normalized !== '/' ? normalized : null);
}
27692
def normpath(path):
    
    funcs = [os.path.normpath, os.path.abspath]
    if "~" in path:
        funcs = [os.path.expanduser] + funcs

    return chaincalls(funcs, path)
1120965
def expand_path(path):
    '''
    
    '''
    expanded = []
    if len(path) < 2:
        return expanded
    for i in range(len(path)-1):
        expanded += bresenham(path[i], path[i + 1])
    expanded += [path[:-1]]
    return expanded
251381
def _GetExpandedPaths(args):
  """"""
  opts = globbing.PathOpts(
      follow_links=args.follow_links, pathtype=args.pathtype)

  for path in args.paths:
    for expanded_path in globbing.ExpandPath(str(path), opts):
      yield expanded_path
1179247
def expanddotpaths(env, console):
    
    for filepath in os.listdir(path.join(env.dir)):
        filename, ext = path.splitext(filepath)
        if ext == '.lua' and '.' in filename:
            paths, newfilename = filename.rsplit('.', 1)
            newpath = paths.replace('.', '/')
            newfilename = path.join(newpath, newfilename) + ext

            console.quiet('Move %s to %s' % (filepath, newfilename))

            fullpath = path.join(env.project_directory, newpath)
            if not path.exists(fullpath):
                os.makedirs(fullpath)

            clom.git.mv(filepath, newfilename).shell.execute()
521953
def parse_relative_path(root_path, experiment_config, key):
    ''''''
    if experiment_config.get(key) and not os.path.isabs(experiment_config.get(key)):
        absolute_path = os.path.join(root_path, experiment_config.get(key))
        print_normal('expand %s: %s to %s ' % (key, experiment_config[key], absolute_path))
        experiment_config[key] = absolute_path
521538
def real_path(aPath)
			(path = Pathname.new(::File.expand_path(aPath))) && path.realpath.to_s
		end