Package org.eclipse.cdt.utils
Class PathUtil
java.lang.Object
org.eclipse.cdt.utils.PathUtil
- Restriction:
- This class is not intended to be subclassed by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanequal(org.eclipse.core.runtime.IPath path1, org.eclipse.core.runtime.IPath path2) Deprecated.static booleanequalPath(org.eclipse.core.runtime.IPath path1, org.eclipse.core.runtime.IPath path2) Checks whether path1 is the same as path2.static org.eclipse.core.runtime.IPathfindProgramLocation(String prog) Finds location of the program inspecting each path in the path list defined by environment variable ${PATH}.static org.eclipse.core.runtime.IPathfindProgramLocation(String prog, String pathsStr) Finds location of the program inspecting each path in the path list.static org.eclipse.core.runtime.IPathgetCanonicalPath(org.eclipse.core.runtime.IPath fullPath) Return the canonical path (or the passed in path, if one couldn't be found).static org.eclipse.core.runtime.IPathgetCanonicalPathWindows(org.eclipse.core.runtime.IPath fullPath) On Windows returns theFile.getCanonicalPath()for a given absolute path.static org.eclipse.core.resources.IProjectgetEnclosingProject(org.eclipse.core.runtime.IPath fullPath) static org.eclipse.core.runtime.IPathgetProjectRelativePath(org.eclipse.core.runtime.IPath fullPath, org.eclipse.core.resources.IProject project) static org.eclipse.core.runtime.IPathgetRawLocation(org.eclipse.core.runtime.IPath wsRelativePath) static org.eclipse.core.runtime.IPathgetValidEnclosingFolder(org.eclipse.core.runtime.IPath fullPath) static org.eclipse.core.runtime.IPathgetWorkspaceRelativePath(String fullPath) static org.eclipse.core.runtime.IPathgetWorkspaceRelativePath(org.eclipse.core.runtime.IPath fullPath) static org.eclipse.core.resources.IWorkspaceRootstatic booleanisPrefix(org.eclipse.core.runtime.IPath path1, org.eclipse.core.runtime.IPath path2) Checks whether path1 is a prefix of path2.static booleanstatic org.eclipse.core.runtime.IPathmakeRelativePath(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath relativeTo) static org.eclipse.core.runtime.IPathmakeRelativePathToIncludes(org.eclipse.core.runtime.IPath fullPath, String[] includePaths) static org.eclipse.core.runtime.IPathmakeRelativePathToProjectIncludes(org.eclipse.core.runtime.IPath fullPath, org.eclipse.core.resources.IProject project) static intmatchingFirstSegments(org.eclipse.core.runtime.IPath path1, org.eclipse.core.runtime.IPath path2) Returns the number of segments which match in path1 and path2 (device ids are ignored), comparing in increasing segment number order.
-
Constructor Details
-
PathUtil
public PathUtil()
-
-
Method Details
-
isWindowsFileSystem
public static boolean isWindowsFileSystem() -
getWorkspaceRoot
public static org.eclipse.core.resources.IWorkspaceRoot getWorkspaceRoot() -
getCanonicalPath
public static org.eclipse.core.runtime.IPath getCanonicalPath(org.eclipse.core.runtime.IPath fullPath) Return the canonical path (or the passed in path, if one couldn't be found).- Parameters:
fullPath-- Returns:
- canonicalized IPath or passed in fullPath.
-
getCanonicalPathWindows
public static org.eclipse.core.runtime.IPath getCanonicalPathWindows(org.eclipse.core.runtime.IPath fullPath) On Windows returns theFile.getCanonicalPath()for a given absolute path. On other platforms, and for relative paths returns the the original path.- Parameters:
fullPath-- Returns:
- canonicalized IPath or passed in fullPath.
- Since:
- 5.3
-
getWorkspaceRelativePath
public static org.eclipse.core.runtime.IPath getWorkspaceRelativePath(org.eclipse.core.runtime.IPath fullPath) -
getProjectRelativePath
public static org.eclipse.core.runtime.IPath getProjectRelativePath(org.eclipse.core.runtime.IPath fullPath, org.eclipse.core.resources.IProject project) -
getWorkspaceRelativePath
-
getRawLocation
public static org.eclipse.core.runtime.IPath getRawLocation(org.eclipse.core.runtime.IPath wsRelativePath) -
makeRelativePath
public static org.eclipse.core.runtime.IPath makeRelativePath(org.eclipse.core.runtime.IPath path, org.eclipse.core.runtime.IPath relativeTo) -
makeRelativePathToProjectIncludes
public static org.eclipse.core.runtime.IPath makeRelativePathToProjectIncludes(org.eclipse.core.runtime.IPath fullPath, org.eclipse.core.resources.IProject project) -
makeRelativePathToIncludes
public static org.eclipse.core.runtime.IPath makeRelativePathToIncludes(org.eclipse.core.runtime.IPath fullPath, String[] includePaths) -
getEnclosingProject
public static org.eclipse.core.resources.IProject getEnclosingProject(org.eclipse.core.runtime.IPath fullPath) -
getValidEnclosingFolder
public static org.eclipse.core.runtime.IPath getValidEnclosingFolder(org.eclipse.core.runtime.IPath fullPath) -
equal
@Deprecated public boolean equal(org.eclipse.core.runtime.IPath path1, org.eclipse.core.runtime.IPath path2) Deprecated.UseequalPath(IPath, IPath)instead.Checks whether path1 is the same as path2.Similar to IPath.equals(Object obj), but takes case sensitivity of the file system into account.
- Returns:
trueif path1 is the same as path2, andfalseotherwise- Since:
- 5.1
-
equalPath
public static boolean equalPath(org.eclipse.core.runtime.IPath path1, org.eclipse.core.runtime.IPath path2) Checks whether path1 is the same as path2.Similar to IPath.equals(Object obj), but takes case sensitivity of the file system into account.
- Returns:
trueif path1 is the same as path2, andfalseotherwise- Since:
- 5.3
-
isPrefix
public static boolean isPrefix(org.eclipse.core.runtime.IPath path1, org.eclipse.core.runtime.IPath path2) Checks whether path1 is a prefix of path2. To be a prefix, path1's segments must appear in path1 in the same order, and their device ids must match.An empty path is a prefix of all paths with the same device; a root path is a prefix of all absolute paths with the same device.
Similar to IPath.isPrefixOf(IPath anotherPath), but takes case sensitivity of the file system into account.
- Returns:
trueif path1 is a prefix of path2, andfalseotherwise- Since:
- 5.1
-
matchingFirstSegments
public static int matchingFirstSegments(org.eclipse.core.runtime.IPath path1, org.eclipse.core.runtime.IPath path2) Returns the number of segments which match in path1 and path2 (device ids are ignored), comparing in increasing segment number order.Similar to IPath.matchingFirstSegments(IPath anotherPath), but takes case sensitivity of the file system into account.
- Returns:
- the number of matching segments
- Since:
- 5.1
-
findProgramLocation
Finds location of the program inspecting each path in the path list.- Parameters:
prog- - program to find. For Windows, extensions "com" and "exe" can be omitted.pathsStr- - the list of paths to inspect separated by path separator defined in the platform (i.e. ":" in Unix and ";" in Windows). In case pathStr isnullenvironment variable ${PATH} is inspected.- Returns:
- - absolute location of the file on the file system
or
nullif not found. - Since:
- 5.3
-
findProgramLocation
Finds location of the program inspecting each path in the path list defined by environment variable ${PATH}.- Parameters:
prog- - program to find. For Windows, extensions "com" and "exe" can be omitted.- Returns:
- - absolute location of the file on the file system
or
nullif not found. - Since:
- 5.3
-
equalPath(IPath, IPath)instead.