if ( lastChar == File.separatorChar )
if ( lastChar == '/' )
	public static String getRelativePath( String base, String resource )	{		// make sure that must be file protocol		String baseDir = getLocalPath( base );		String resourceDir = getLocalPath( resource );		if ( baseDir == null || resourceDir == null )			return resource;		File baseFile = new File( baseDir );		File resourceFile = new File( resourceDir );		// get platform-depedent file path by using Java File class		baseDir = baseFile.getAbsolutePath( );		resourceDir = resourceFile.getAbsolutePath( );		// do the string match to get the location of same prefix		int matchedPos = 0;		for ( matchedPos = 0; matchedPos < baseDir.length( )				&& matchedPos < resourceDir.length( ); matchedPos++ )		{			if ( baseDir.charAt( matchedPos ) != resourceDir					.charAt( matchedPos ) )				break;		}		// adjust the same prefix by the path separator		// for the special case like:		// baseDir: c:/hello/test		// resourceDir: c:/hello/test/library.xml		// then the matched position is the length of baseDir insteadof		// the slash before "test".		if ( isLastDirectoryMatched( baseDir, resourceDir, matchedPos )				|| isLastDirectoryMatched( resourceDir, baseDir, matchedPos ) )			;		else			matchedPos = baseDir.lastIndexOf( File.separator, matchedPos );		// saves the matched position		int samePrefixPos = matchedPos;		int upDirs = 0;		// calcualtes out the number of up directory should have.		while ( matchedPos < baseDir.length( ) && matchedPos > 0 )		{			matchedPos = baseDir.indexOf( File.separator, matchedPos + 1 );			upDirs++;		}		// appends up directories information.		StringBuffer sb = new StringBuffer( );		for ( int i = 0; i < upDirs; i++ )		{			sb.append( ".." + File.separator ); //$NON-NLS-1$		}		// appends the relative path.		if ( samePrefixPos < resourceDir.length( ) )			sb.append( resourceDir.substring( samePrefixPos + 1 ) );		// remove the tail file.separatorChar		int len = sb.length( );		if ( len > 0 )		{			char lastChar = sb.charAt( len - 1 );			if ( lastChar == File.separatorChar )				sb.deleteCharAt( len - 1 );		}		return sb.toString( );	}