Updated Branches: refs/heads/master 49ba56e1a -> dc2eae49f
[SSHD-257] Possible fix for not using nio2 file system with windows Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/dc2eae49 Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/dc2eae49 Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/dc2eae49 Branch: refs/heads/master Commit: dc2eae49f24caff5f1b68770aa52f0cdc8961159 Parents: 49ba56e Author: Guillaume Nodet <[email protected]> Authored: Fri Nov 29 20:41:08 2013 +0100 Committer: Guillaume Nodet <[email protected]> Committed: Fri Nov 29 20:41:08 2013 +0100 ---------------------------------------------------------------------- .../sshd/common/file/nativefs/NativeFileSystemView.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/dc2eae49/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemView.java ---------------------------------------------------------------------- diff --git a/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemView.java b/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemView.java index a39c4c8..e78b562 100644 --- a/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemView.java +++ b/sshd-core/src/main/java/org/apache/sshd/common/file/nativefs/NativeFileSystemView.java @@ -114,7 +114,9 @@ public class NativeFileSystemView implements FileSystemView { } static boolean isJava7; + static boolean isWindows; static { + // Check java 7 boolean j7 = false; try { ClassLoader.getSystemClassLoader().loadClass("java.nio.file.Files"); @@ -123,10 +125,18 @@ public class NativeFileSystemView implements FileSystemView { // Ignore } isJava7 = j7; + // Check windows + boolean win = false; + try { + win = System.getProperty("os.name").toLowerCase().contains("win"); + } catch (Throwable t) { + // Ignore + } + isWindows = win; } public NativeSshFile createNativeSshFile(final String fileName2, final File fileObj, final String userName2) { - if (isJava7) { + if (isJava7 && !isWindows) { return new NativeSshFileNio(this, fileName2, fileObj, userName2); } else { return new NativeSshFile(this, fileName2, fileObj, userName2);
