List of usage examples for org.apache.commons.vfs2.util Os isFamily
public static boolean isFamily(final OsFamily family)
From source file:SftpClientFactory.java
/** * Finds the .ssh directory./*from ww w . j a v a2 s .c o m*/ * <p>The lookup order is:</p> * <ol> * <li>The system property <code>vfs.sftp.sshdir</code> (the override * mechanism)</li> * <li><code>{user.home}/.ssh</code></li> * <li>On Windows only: C:\cygwin\home\{user.name}\.ssh</li> * <li>The current directory, as a last resort.</li> * <ol> * <p/> * Windows Notes: * The default installation directory for Cygwin is <code>C:\cygwin</code>. * On my set up (Gary here), I have Cygwin in C:\bin\cygwin, not the default. * Also, my .ssh directory was created in the {user.home} directory. * </p> * * @return The .ssh directory */ private static File findSshDir() { String sshDirPath; sshDirPath = System.getProperty("vfs.sftp.sshdir"); if (sshDirPath != null) { File sshDir = new File(sshDirPath); if (sshDir.exists()) { return sshDir; } } File sshDir = new File(System.getProperty("user.home"), SSH_DIR_NAME); if (sshDir.exists()) { return sshDir; } if (Os.isFamily(Os.OS_FAMILY_WINDOWS)) { // TODO - this may not be true final String userName = System.getProperty("user.name"); sshDir = new File("C:\\cygwin\\home\\" + userName + "\\" + SSH_DIR_NAME); if (sshDir.exists()) { return sshDir; } } return new File(""); }