From: Sasa M. <sa...@us...> - 2004-07-14 12:52:42
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22919/org/jrobin/core Modified Files: RrdDb.java Util.java Log Message: Minor interventions to graph demo applications - path to res/demo directory is now determined during runtime. See Util.getJrobinHomeDirectory for explanation. Index: Util.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/Util.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Util.java 12 Jul 2004 13:35:16 -0000 1.18 --- Util.java 14 Jul 2004 12:52:34 -0000 1.19 *************** *** 496,499 **** return "[" + seconds + " sec]"; } ! } \ No newline at end of file --- 496,536 ---- return "[" + seconds + " sec]"; } ! ! /** ! * Returns the root directory of the JRobin distribution. Useful in some demo applications, ! * probably of no use anywhere else.<p> ! * ! * The function assumes that all JRobin .class files are placed under ! * the <root>/classes subdirectory and that all jars (libraries) are placed in the ! * <root>/lib subdirectory (the original JRobin directory structure).<p> ! * ! * @return absolute path to JRobin's home directory ! */ ! public static String getJRobinHomeDirectory() { ! String className = Util.class.getName().replace('.', '/'); ! String uri = Util.class.getResource("/" + className + ".class").toString(); ! if(uri.startsWith("file:/")) { ! uri = uri.substring(6); ! File file = new File(uri); ! // let's go 5 steps backwards ! for(int i = 0; i < 5; i++) { ! file = file.getParentFile(); ! } ! uri = file.getAbsolutePath(); ! } ! else if(uri.startsWith("jar:file:/")) { ! uri = uri.substring(10, uri.lastIndexOf('!')); ! File file = new File(uri); ! // let's go 2 steps backwards ! for(int i = 0; i < 2; i++) { ! file = file.getParentFile(); ! } ! uri = file.getAbsolutePath(); ! } ! else { ! uri = null; ! } ! return uri; ! } ! } \ No newline at end of file Index: RrdDb.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdDb.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** RrdDb.java 9 Jul 2004 12:20:10 -0000 1.23 --- RrdDb.java 14 Jul 2004 12:52:34 -0000 1.24 *************** *** 988,991 **** --- 988,992 ---- public static void main(String[] args) { + System.out.println("JRobin base directory: " + Util.getJRobinHomeDirectory()); System.out.println("JRobin Java Library :: RRDTool choice for the Java world"); System.out.println("http://www.jrobin.org"); |