Interface PathCreator
- All Known Implementing Classes:
DirectoryWithPrefix
public interface PathCreator
Converts file-paths between relative and absolute.
- Author:
- Owen Feehan
-
Method Summary
Modifier and TypeMethodDescriptionGenerates a full path, given the final part (suffix) of a path.makePathRelative(Path suffix) Extracts a relative-file path, given the final part (suffix) of a path.
-
Method Details
-
makePathAbsolute
Generates a full path, given the final part (suffix) of a path.All sub-directories are created if needed to ensure it's possible to write to the fullPath.
- Parameters:
suffix- the final part of the path, to be added to the prefixextension- a file extension (without a leading period).fallbackSuffix- if neither aprefixis defined nor asuffix, then this provides a suffix to use so a file isn't only an extension.- Returns:
- a complete absolute path with all components (prefix, suffix) etc., including the leading directory.
-
makePathRelative
Extracts a relative-file path, given the final part (suffix) of a path.The path will be relative to the underlying root
directory.This relative-path includes any filename-prefix added by the
DirectoryWithPrefix.- Parameters:
suffix- the final part of the path, to be added to the prefix- Returns:
- a complete relative path with all components (prefix, suffix) etc., but no leading directory.
-