Class RelativePath
- java.lang.Object
-
- com.atlassian.bamboo.persister.xstream.RelativePath
-
public class RelativePath extends Object
This class converts an Absolute Path into a Relative Path. Used to ensure we only persist relative paths.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
getRelativePath
public static String getRelativePath(File homeDirectory, File fileToMakeRelative)
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
public static List getPathElements(File file)
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
-
-