/** * Returns path to directory used for placement of Rrd4j demo graphs and creates it * if necessary. * * @return Path to demo directory (defaults to $HOME/rrd4j/) if directory exists or * was successfully created. Null if such directory could not be created. */ public static String getRrd4jDemoDirectory() { String homeDirPath = getUserHomeDirectory() + RRD4J_DIR + getFileSeparator(); File homeDirFile = new File(homeDirPath); return (homeDirFile.exists() || homeDirFile.mkdirs()) ? homeDirPath : null; }
/** * Returns path to directory used for placement of Rrd4j demo graphs and creates it * if necessary. * * @return Path to demo directory (defaults to $HOME/rrd4j/) if directory exists or * was successfully created. Null if such directory could not be created. */ public static String getRrd4jDemoDirectory() { Path root; if (System.getProperty("rrd4j.demopath") != null) { root = Paths.get(System.getProperty("rrd4j.demopath")); } else { root = Paths.get(getUserHomeDirectory(), RRD4J_DIR); } try { Files.createDirectories(root); return root.toAbsolutePath().toString() + File.separator; } catch (IOException e) { return null; } }