Gives the display value for a given path, making it relative to cwd
    if possible.
168206
def display_path(path):
    """"""
    path = os.path.normcase(os.path.abspath(path))
    if path.startswith(os.getcwd() + os.path.sep):
        path = '.' + path[len(os.getcwd()):]
    return path
396384
def get_relative_image_path(self, path):
        

        if not path:
            return ""
        path = force_unix_path(self.get_abs_image_path(path))

        img_directory = self.get_images_directory()

        for directory in images_directories(self._NODE_TYPE):
            if os.path.commonprefix([directory, path]) == directory:
                relpath = os.path.relpath(path, directory)
                # We don't allow to recurse search from the top image directory just for image type directory (compatibility with old releases)
                if os.sep not in relpath or directory == img_directory:
                    return relpath
        return path
790542
def display_value(self, ctx, value):
        
        gandi = ctx.obj
        gandi.log('%s: %s' % (self.name, (value if value is not None
                                          else 'Not found')))
776323
def get_path(dest, file, cwd = None):
	""""""
	if callable(dest):
		return dest(file)

	if not cwd:
		cwd = file.cwd
	if not os.path.isabs(dest):
		dest = os.path.join(cwd, dest)

	relative = os.path.relpath(file.path, file.base)
	return os.path.join(dest, relative)
886405
public void getAndDisplayNode(final String path, final boolean changeHistory) {
        showLoadIcon();
        console.jcrService().node(repository(), workspace(), path, new AsyncCallback<JcrNode>() {
            @Override
            public void onFailure(Throwable caught) {
                hideLoadIcon();
                SC.say(caught.getMessage());
            }

            @Override
            public void onSuccess(JcrNode node) {
                displayNode(node);
                console.changeWorkspaceInURL(workspace(), changeHistory);
                console.changePathInURL(path, changeHistory);
                hideLoadIcon();
            }
        });
    }
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)
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)
243850
def is_path_creatable(pathname: str) -> bool:
    
    # Parent directory of the passed path. If empty, we substitute the current
    # working directory (CWD) instead.
    dirname = os.path.dirname(pathname) or os.getcwd()
    return os.access(dirname, os.W_OK)
660089
def short_path(path, cwd=None):
    
    if not isinstance(path, str):
        return path
    if cwd is None:
        cwd = os.getcwd()
    abspath = os.path.abspath(path)
    relpath = os.path.relpath(path, cwd)
    if len(abspath) <= len(relpath):
        return abspath
    return relpath
1075009
function getDotSeparatedPath(path) {
  return path.split('.').reduce((splitPath, pathItem) => !pathItem ? splitPath : [...splitPath, getKey(pathItem)], []);
}
955018
def get_cwd(options):
    
    if not options.cwd:
        return None
    if not os.path.exists(options.cwd):
        raise exceptions.InvalidCwd(
            "can't --cwd to invalid path {0!r}".format(options.cwd))
    return options.cwd
1047735
private URL getRelativePath(FacesContext facesContext, String path) throws IOException
    {
        URL url = (URL) _relativePaths.get(path);
        if (url == null)
        {
            url = _factory.resolveURL(facesContext, _src, path);
            if (url != null)
            {
                ViewResource viewResource = (ViewResource) facesContext.getAttributes().get(
                    FaceletFactory.LAST_RESOURCE_RESOLVED);
                if (viewResource != null)
                {
                    // If a view resource has been used to resolve a resource, the cache is in
                    // the ResourceHandler implementation. No need to cache in _relativeLocations.
                }
                else
                {
                    _relativePaths.put(path, url);
                }
            }
        }
        return url;
    }
571914
def read_value_from_path(value):
    
    if value.startswith('file://'):
        path = value.split('file://', 1)[1]
        config_directory = get_config_directory()
        relative_path = os.path.join(config_directory, path)
        with open(relative_path) as read_file:
            value = read_file.read()
    return value
398608
def lwd(self, astr_startPath, **kwargs):
            
            if self.cd(astr_startPath)['status']:
                self.l_lwd.append(self.cwd())

            return {'status': True, 'cwd': self.cwd()}
355068
def GetDisplayNameForPathSpec(self, path_spec):
    
    return path_helper.PathHelper.GetDisplayNameForPathSpec(
        path_spec, mount_path=self._mount_path, text_prepend=self._text_prepend)
788722
def relative_path(path):
    
    return os.path.join(os.path.dirname(__file__), path)
1102941
public void lcd(String path) throws SftpStatusException {
		File actual;

		if (!isLocalAbsolutePath(path)) {
			actual = new File(lcwd, path);
		} else {
			actual = new File(path);
		}

		if (!actual.isDirectory()) {
			throw new SftpStatusException(SftpStatusException.SSH_FX_FAILURE,
					path + " is not a directory");
		}

		try {
			lcwd = actual.getCanonicalPath();
		} catch (IOException ex) {
			throw new SftpStatusException(SftpStatusException.SSH_FX_FAILURE,
					"Failed to canonicalize path " + path);
		}
	}