From 60f92b8bbd9f3f988a05ad64b0ba47a2b164d1a9 Mon Sep 17 00:00:00 2001 From: ab3dat <32623587+ab3dat@users.noreply.github.com> Date: Tue, 9 Jul 2019 17:03:39 +0200 Subject: [PATCH 1/2] Checks java file encoding on windows (PR #75) This implementation checks whether the UTF-8 file encoding is set when working on windows. If the wrong file encoding is set mounting the drive works, but accessing and working on it doesn't work. Details see pull request #75 --- src/main/java/ru/serce/jnrfuse/AbstractFuseFS.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/serce/jnrfuse/AbstractFuseFS.java b/src/main/java/ru/serce/jnrfuse/AbstractFuseFS.java index e5b90bd..59a3edd 100755 --- a/src/main/java/ru/serce/jnrfuse/AbstractFuseFS.java +++ b/src/main/java/ru/serce/jnrfuse/AbstractFuseFS.java @@ -62,7 +62,11 @@ public AbstractFuseFS() { } break; case WINDOWS: - String winFspPath = WinPathUtils.getWinFspPath(); + if (!System.getProperty("file.encoding").equals("UTF-8")) + { + System.out.println("UTF-8 encoding required! Current encoding: " + System.getProperty("file.encoding")); + } + String winFspPath = WinPathUtils.getWinFspPath(); libFuse = loader.load(winFspPath); break; default: From 8d1b4dd668ca5a2f9e7ddda9edd52cfd8cdbc815 Mon Sep 17 00:00:00 2001 From: ab3dat <32623587+ab3dat@users.noreply.github.com> Date: Tue, 9 Jul 2019 23:55:22 +0200 Subject: [PATCH 2/2] Throw exception if file encoding not UTF-8 (PR #75) Replace output to stdout and throw exception if file encoding is not UTF-8 if running on Windows Details see pull request #75 --- src/main/java/ru/serce/jnrfuse/AbstractFuseFS.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/ru/serce/jnrfuse/AbstractFuseFS.java b/src/main/java/ru/serce/jnrfuse/AbstractFuseFS.java index 59a3edd..de4bc51 100755 --- a/src/main/java/ru/serce/jnrfuse/AbstractFuseFS.java +++ b/src/main/java/ru/serce/jnrfuse/AbstractFuseFS.java @@ -64,7 +64,7 @@ public AbstractFuseFS() { case WINDOWS: if (!System.getProperty("file.encoding").equals("UTF-8")) { - System.out.println("UTF-8 encoding required! Current encoding: " + System.getProperty("file.encoding")); + throw new FuseException("UTF-8 encoding required! Current encoding: " + System.getProperty("file.encoding")); } String winFspPath = WinPathUtils.getWinFspPath(); libFuse = loader.load(winFspPath);