Package org.eclipse.aether.util
Class DirectoryUtils
java.lang.Object
org.eclipse.aether.util.DirectoryUtils
A utility class to calculate (and create if needed) paths backed by directories using configuration properties from
 repository system session and others.
- Since:
- 1.9.0
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionstatic PathresolveDirectory(String name, Path base, boolean mayCreate) CreatesPathinstance out of passed innameparameter.static PathresolveDirectory(RepositorySystemSession session, String defaultName, String nameKey, boolean mayCreate) CreatesPathinstance out of session configuration, and (if relative) resolve it against local repository basedir.
- 
Method Details- 
resolveDirectoryCreatesPathinstance out of passed innameparameter. May create a directory on resulting path, if not exist, when invoked withmayCreatebeingtrue. Never returnsnull.Following outcomes may happen: - nameis absolute path - results in- Pathinstance created directly from name.
- nameis relative path - results in- Pathinstance resolved against- baseparameter.
 mayCreateistrue. If resulting path exist but is not a directory, this method will throw.- Parameters:
- name- the name to create directory with, cannot be- null
- base- the base- Pathto resolve name, if it is relative path, cannot be- null
- mayCreate- if resulting path does not exist, should it create?
- Returns:
- the Pathinstance that is resolved and backed by existing directory
- Throws:
- IOException- if some IO related errors happens
 
- 
resolveDirectorypublic static Path resolveDirectory(RepositorySystemSession session, String defaultName, String nameKey, boolean mayCreate) throws IOException CreatesPathinstance out of session configuration, and (if relative) resolve it against local repository basedir. Pre-populates values and invokesresolveDirectory(String, Path, boolean).For this method to work, LocalRepository.getBasePath()must return non-nullvalue, otherwiseNullPointerExceptionis thrown.- Parameters:
- session- the session, may not be- null
- defaultName- the default value if not present in session configuration, may not be- null
- nameKey- the key to look up for in session configuration to obtain user set value
- mayCreate- if resulting path does not exist, should it create?
- Returns:
- the Pathinstance that is resolved and backed by existing directory
- Throws:
- IOException- if some IO related errors happens
- See Also:
 
 
-