This function will return an appropriate absolute path for the path it is
    given. If the input is absolute, it will return unmodified; if the input is
    relative, it will be rendered as relative to the current working directory.
490178
def get_absolute_path(some_path):
    
    if os.path.isabs(some_path):
        return some_path
    else:
        return evaluate_relative_path(os.getcwd(), some_path)
973224
def _work_path_to_rel_final_path(path, upload_path_mapping, upload_base_dir):
    
    if not path or not isinstance(path, str):
        return path
    upload_path = None

    # First, check in the mapping: if it's there is a direct reference and
    # it's a file, we immediately return it (saves lots of iterations)
    if upload_path_mapping.get(path) is not None and os.path.isfile(path):
        upload_path = upload_path_mapping[path]
    else:
        # Not a file: check for elements in the mapping that contain
        # it
        paths_to_check = [key for key in upload_path_mapping
                          if path.startswith(key)]

        if paths_to_check:
            for work_path in paths_to_check:
                if os.path.isdir(work_path):
                    final_path = upload_path_mapping[work_path]
                    upload_path = path.replace(work_path, final_path)
                    break

    if upload_path is not None:
        return os.path.relpath(upload_path, upload_base_dir)
    else:
        return None
1310490
function ensureRelative(outputDir, p) {
    if (path.isAbsolute(p)) {
        return path.relative(outputDir, p);
    } else {
        return p;
    }
}
31858
def absolute_path(user_path):
    
    if os.path.abspath(user_path):
        return unix_path_coercion(user_path)
    else:
        try:
            openaccess_epub.utils.evaluate_relative_path(relative=user_path)
        except:
            raise ValidationError('This path could not be rendered as absolute')
387269
def relative(self):
        
        if not self.is_absolute():
            raise ValueError("URL should be absolute")
        val = self._val._replace(scheme="", netloc="")
        return URL(val, encoded=True)
80123
def relative_path(path)
      base_dir = Dir.pwd

      return path[(base_dir.length + 1)..-1] if path.start_with?(base_dir)

      path_name = Pathname.new(File.expand_path(path))
      path_name.relative_path_from(Pathname.new(base_dir)).to_s
    end
669349
def abspath(self, path):
        """"""

        def getcwd():
            """Return the current working directory."""
            # pylint: disable=undefined-variable
            if IS_PY2 and isinstance(path, text_type):
                return self.os.getcwdu()
            elif not IS_PY2 and isinstance(path, bytes):
                return self.os.getcwdb()
            else:
                return self.os.getcwd()

        path = make_string_path(path)
        sep = self.filesystem._path_separator(path)
        altsep = self.filesystem._alternative_path_separator(path)
        if not self.isabs(path):
            path = self.join(getcwd(), path)
        elif (self.filesystem.is_windows_fs and
              path.startswith(sep) or altsep is not None and
              path.startswith(altsep)):
            cwd = getcwd()
            if self.filesystem._starts_with_drive_letter(cwd):
                path = self.join(cwd[:2], path)
        return self.normpath(path)
712759
def abspath(fpath):
    
    from os import path, getcwd, chdir
    original = getcwd()
    chdir(reporoot)
    result = path.abspath(path.expanduser(fpath))
    chdir(original)
    return result
755772
def determine_path():
    """"""
    root = __file__
    if os.path.islink(root):
        root = os.path.realpath(root)
    return os.path.dirname(os.path.abspath(root))
513897
def get_abspath(path, content_dir=CONTENT_DIR):
    
    if path:
        file = re.search('content://(.+)', path)
        if file:
            return os.path.join(content_dir, file.group(1))
    return path
479056
def _relative_path_to(path_list, filename):
    """"""
    return os.path.join(
        os.path.relpath(os.path.join(*path_list), os.getcwd()),
        filename
    )
669561
function resolvePath(_path, relativePath = currentWorkDir) {
  if (!isString(_path) || _path.startsWith('~')) {
    return _path;
  }
  const file = nativePath.relative(relativePath, _path);
  return nativePath.join(relativePath, file);
}
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
104555
function relative(aRoot, aPath) {
    if (aRoot === "") {
      aRoot = ".";
    }

    aRoot = aRoot.replace(/\/$/, '');

    // It is possible for the path to be above the root. In this case, simply
    // checking whether the root is a prefix of the path won't work. Instead, we
    // need to remove components from the root one by one, until either we find
    // a prefix that fits, or we run out of components to remove.
    var level = 0;
    while (aPath.indexOf(aRoot + '/') !== 0) {
      var index = aRoot.lastIndexOf("/");
      if (index < 0) {
        return aPath;
      }

      // If the only part of the root that is left is the scheme (i.e. http://,
      // file:///, etc.), one or more slashes (/), or simply nothing at all, we
      // have exhausted all components, so the path is not relative to the root.
      aRoot = aRoot.slice(0, index);
      if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
        return aPath;
      }

      ++level;
    }

    // Make sure we add a "../" for each component we removed from the root.
    return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
  }
1330465
def _relativePath(self, fullPath):
        
        if fullPath is None:
            return None

        assert fullPath.startswith("/"), fullPath

        path = os.path.relpath(fullPath, self.userPath)

        if not path.startswith("../"):
            return path
        elif self.ignoreExtraVolumes:
            return None
        else:
            return fullPath
849552
def relpath_for(self, path):
        """"""
        if self.parent_dir in (".", ""):
            return path

        if path == self.parent_dir:
            return ""

        dirname = os.path.dirname(path) or "."
        basename = os.path.basename(path)

        cached = self.relpath_cache.get(dirname, empty)
        if cached is empty:
            cached = self.relpath_cache[dirname] = os.path.relpath(dirname, self.parent_dir)

        return os.path.join(cached, basename)
788722
def relative_path(path):
    
    return os.path.join(os.path.dirname(__file__), path)