/** * Expand a path name, for example by replacing a leading tilde by the user's home directory (if * defined on that platform). * * @param path * @return the expanded path */ @DataParallel @Internal("path.expand") public static String pathExpand(String path) { if (path.startsWith("~/")) { return java.lang.System.getProperty("user.home") + path.substring(2); } else { return path; } }
@Internal("Sys.info") public static StringVector sysInfo() { StringVector.Builder sb = new StringVector.Builder(); sb.add(java.lang.System.getProperty("os.name")); sb.add(java.lang.System.getProperty("os.version")); /* * os.build does not exist! maybe we can put jvm info instead? * */ sb.add(java.lang.System.getProperty("os.build")); try { sb.add(InetAddress.getLocalHost().getHostName()); } catch (Exception e) { sb.add("Can not get hostname"); } sb.add(java.lang.System.getProperty("os.arch")); /* * * login.name does not exist! */ sb.add(java.lang.System.getProperty("login.name")); sb.add(java.lang.System.getProperty("user.name")); sb.setAttribute( "names", new StringArrayVector( "sysname", "release", "version", "nodename", "machine", "login", "user")); return (sb.build()); }
/** * <strong>According to the R docs:</strong> a subdirectory of the temporary directory found by * the following rule. The environment variables TMPDIR, TMP and TEMP are checked in turn and the * first found which points to a writable directory is used: if none succeeds the value of R_USER * (see Rconsole) is used. If the path to the directory contains a space in any of the components, * the path returned will use the shortnames version of the path. * * <p>This implementation also returns the value of {@code System.getProperty(java.io.tmpdir) } * * @return temporary sub directory */ @Internal public static String tempdir() { return java.lang.System.getProperty("java.io.tmpdir"); }