Class RelativePath
java.lang.Object
com.atlassian.bamboo.persister.xstream.RelativePath
This class converts an Absolute Path into a Relative Path. Used to ensure we only persist relative paths.
-
Method Summary
Modifier and TypeMethodDescriptionstatic List
getPathElements
(File file) Get a list of the files individual path elements.static String
getRelativePath
(File homeDirectory, File fileToMakeRelative) get relative path of fileToMakeRelative with respect to the homeDirectory
-
Method Details
-
getRelativePath
get relative path of fileToMakeRelative with respect to the homeDirectory- Parameters:
homeDirectory
- base directoryfileToMakeRelative
- File we are generating the relative path- Returns:
- The relative path to get from home to fileToMakeRelative
-
getPathElements
Get a list of the files individual path elements.For example, "/a/b/c/d.txt", will return [d.txt,c,b,a]
Note: on Windows, "c:\foo.txt" will return [foo.txt, ] because c:\ has no name.
- Parameters:
file
- input file- Returns:
- a List collection with the individual elements of the path in reverse order
-