com.atlassian.bamboo.persister.xstream
Class RelativePath

java.lang.Object
  extended by com.atlassian.bamboo.persister.xstream.RelativePath

public class RelativePath
extends java.lang.Object

This class converts an Absolute Path into a Relative Path. Used to ensure we only persist relative paths.


Method Summary
static java.util.List getPathElements(java.io.File file)
          Get a list of the files individual path elements.
static java.lang.String getRelativePath(java.io.File homeDirectory, java.io.File fileToMakeRelative)
          get relative path of fileToMakeRelative with respect to the homeDirectory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRelativePath

public static java.lang.String getRelativePath(java.io.File homeDirectory,
                                               java.io.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 java.util.List getPathElements(java.io.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


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.