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 Details

    • getRelativePath

      public static String getRelativePath(File homeDirectory, File fileToMakeRelative)
      get relative path of fileToMakeRelative with respect to the homeDirectory
      Parameters:
      homeDirectory - base directory
      fileToMakeRelative - 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