Validates the given string as a path for a resource of the given type(s).
In addition to the restrictions for paths in general (see IPath.isValidPath
), a resource path should also obey the following rules:
- a resource path should be an absolute path with no device id
- its segments should be valid names according to
validateName
- a path for the workspace root must be the canonical root path
- a path for a project should have exactly 1 segment
- a path for a file or folder should have more than 1 segment
- the first segment should be a valid project name
- the second through penultimate segments should be valid folder names
- the last segment should be a valid name of the given type
Note: this method does not consider whether a resource at the specified path exists.
This validation check is done automatically as a resource is created (but not when the resource handle is constructed); this means that any resource that exists can be safely assumed to have a valid name and path.
@param path the path string to be checked
@param typeMask bitwise-or of the resource type constants (
FILE
,
FOLDER
,
PROJECT
, or
ROOT
) indicating expected resource type(s)
@return a status object with code
IStatus.OK
if the givenpath is valid as a resource path, otherwise a status object indicating what is wrong with the string
@see IResource#PROJECT
@see IResource#FOLDER
@see IResource#FILE
@see IStatus#OK
@see IResourceStatus#getPath()