Get the absolute path relative to the current folder,
which is the parent folder of <b>classpath</b> (<b>classes/</b> or <b>lib/</b>) by default
769519
public static synchronized String getAbsolutePath(String path) {
		try {
			if (rootDir == null) {
				Class<?> parentClass = getParentClass();
				String classFile = parentClass.getName().replace('.', '/') + ".class";
				URL url = parentClass.getResource("/" + classFile);
				if (url == null) {
					return null;
				}
				if (url.getProtocol().equals("jar")) {
					rootDir = url.getPath();
					int i = rootDir.lastIndexOf('!');
					if (i >= 0) {
						rootDir = rootDir.substring(0, i);
					}
					rootDir = new File(new URL(rootDir).toURI()).getParent();
				} else {
					rootDir = new File(url.toURI()).getPath();
					rootDir = rootDir.substring(0, rootDir.length() - classFile.length());
					if (rootDir.endsWith(File.separator)) {
						rootDir = rootDir.substring(0, rootDir.length() - 1);
					}
				}
				rootDir = new File(rootDir).getParent();
			}
			return new File(rootDir + File.separator + path).getCanonicalPath();
		} catch (IOException | URISyntaxException e) {
			throw new RuntimeException(e);
		}
	}
676053
def get_parent_dir(name):
    """"""
    parent_dir = os.path.dirname(os.path.dirname(name))
    if parent_dir:
        return parent_dir
    return os.path.abspath('.')
367237
def path(self):
        """"""

        if self.parent:
            try:
                parent_path = self.parent.path.encode()
            except AttributeError:
                parent_path = self.parent.path
            return os.path.join(parent_path, self.name)
        return b"/"
344589
public static String getRelativePathName(Path root, Path path) {
        Path relative = root.relativize(path);
        return Files.isDirectory(path) && !relative.toString().endsWith("/") ? String.format("%s/", relative.toString()) : relative.toString();
    }
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
1322275
public CPath getCPath()
    {
        if ( parent == null ) {
            return CPath.ROOT;
        }

        CMFolder currentFolder = this;
        StringBuilder path = new StringBuilder(  );

        while ( currentFolder.parent != null ) {
            path.insert( 0, currentFolder.name );
            path.insert( 0, '/' );

            currentFolder = currentFolder.parent;
        }

        return new CPath( path.toString() );
    }
1052573
private static String getFolderPath(String folderPath) {
        File folder = new File(folderPath);
        if (folder.exists() && folder.isFile()) {
            String tempPath = folder.getParent();
            folder = new File(tempPath);
        }
        if (!folder.exists()) {
            folder.mkdirs();
        }
        return folder.getPath();
    }
407177
public static Path currentDataDirectory()
  {
    RootDirectorySystem rootService = getCurrent();
    
    if (rootService == null)
      throw new IllegalStateException(L.l("{0} must be active for getCurrentDataDirectory().",
                                          RootDirectorySystem.class.getSimpleName()));
    
    return rootService.dataDirectory();
  }
978788
public static String getCurrentClasspath() {
		final StringBuilder path = new StringBuilder();
		for (final URL url : getCurrentClassLoader().getURLs()) {
			if (path.length() > 0) {
				path.append(File.pathSeparator);
			}
			final File file = FileSystem.convertURLToFile(url);
			if (file != null) {
				path.append(file.getAbsolutePath());
			}
		}
		return path.toString();
	}
175937
public Path getParent() {
		if (!isAbsolute())
			throw new IllegalStateException("path is not absolute: " + toString());
		if (segments.isEmpty())
			return null;
		return new Path(segments.subList(0, segments.size()-1), true);
	}
1103337
public String getAbsolutePath() {
        StringBuilder pathBuilder = new StringBuilder("/").append(this.getName());
        AstNode parent = this.getParent();
        while (parent != null) {
            pathBuilder.insert(0, "/" + parent.getName());
            parent = parent.getParent();
        }
        return pathBuilder.toString();
    }
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
893730
def parent_folder(path, base=None):
    
    return path and os.path.dirname(resolved_path(path, base=base))
297226
public CMFolder getFolder( CPath path )
    {
        List<String> baseNames = path.split();

        if (path.isRoot() ){
            return this;
        }

        CMFolder currentFolder = this;
        CMFolder subFolder = null;

        for ( String baseName : baseNames ) {
            subFolder = currentFolder.getChildByName( baseName );

            if ( subFolder == null ) {
                return null;
            }

            currentFolder = subFolder;
        }

        return subFolder;
    }
421275
public static String buildProperPath(String parentPath, String relativePathFromParent) {
        if (relativePathFromParent == null) return null;
        if (parentPath != null) {
            parentPath = parentPath.trim();
        }

        if (relativePathFromParent.startsWith(PATH_CURRENT)) {
            relativePathFromParent = relativePathFromParent.replaceFirst("(./)+", "");
        }

        String path;

        if (relativePathFromParent.startsWith(PATH_ROOT)) { //absolute
            path = relativePathFromParent;
        } else if (relativePathFromParent.startsWith(PATH_PARENT)) {
            while (relativePathFromParent.startsWith(PATH_PARENT)) {
                relativePathFromParent = relativePathFromParent.replaceFirst(PATH_PARENT, "");
                if (relativePathFromParent.startsWith(PATH_CURRENT)) {
                    relativePathFromParent = relativePathFromParent.replaceFirst(PATH_CURRENT, "");
                }
                parentPath = (parentPath == null || parentPath.equals(PATH_ROOT)) ? PATH_ROOT : getParentPath(parentPath);
            }
            path = parentPath + PATH_ROOT + relativePathFromParent;
        } else {
            path = parentPath + PATH_ROOT + relativePathFromParent;
        }

        return path.replaceAll("(/|\\./)+", "$1");
    }
534072
def get_abs_path(relative_path):
    
    abs_path = os.path.sep.join(
        os.path.abspath(sys.modules[__name__].__file__).split(os.path.sep)[:-1])
    abs_path = os.path.abspath(abs_path + os.path.sep + relative_path)
    return abs_path
4815
def get_path_url(path, relative=False):
    
    if relative:
        return os.path.relpath(path)
    else:
        return 'file://%s' % os.path.abspath(path)