info.flexmojos.utilities
Class PathUtil

java.lang.Object
  extended by info.flexmojos.utilities.PathUtil

public class PathUtil
extends java.lang.Object

this class provides functions used to generate a relative path from two absolute paths

Author:
David M. Howard

Constructor Summary
PathUtil()
           
 
Method Summary
static java.lang.String getRelativePath(java.io.File home, java.io.File f)
          get relative path of File 'f' with respect to 'home' directory example : home = /a/b/c f = /a/d/e/x.txt s = getRelativePath(home,f) = ../..
static void main(java.lang.String[] args)
          test the function
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PathUtil

public PathUtil()
Method Detail

getRelativePath

public static java.lang.String getRelativePath(java.io.File home,
                                               java.io.File f)
get relative path of File 'f' with respect to 'home' directory example : home = /a/b/c f = /a/d/e/x.txt s = getRelativePath(home,f) = ../../d/e/x.txt

Parameters:
home - base path, should be a directory, not a file, or it doesn't make sense
f - file to generate path for
Returns:
path from home to f as a string

main

public static void main(java.lang.String[] args)
test the function



Copyright © 2008-2009 Flex-Mojos. All Rights Reserved.