/** * Resolve <code>~</code> in the path. */ public static String resolveHome(String path) { if (path.length() == 1) { if (path.charAt(0) == '~') { return SystemUtil.userHome(); } return path; } if (path.length() >= 2) { if ((path.charAt(0) == '~') && (path.charAt(1) == File.separatorChar)) { return SystemUtil.userHome() + path.substring(1); } } return path; }