From b975449b69a57d900b14d7b25fbde6b1e162f0d7 Mon Sep 17 00:00:00 2001 From: Catfriend1 Date: Fri, 27 Jul 2018 01:40:53 +0200 Subject: [PATCH] WIP - Do not run --- .../com/nutomic/syncthingandroid/util/Util.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/nutomic/syncthingandroid/util/Util.java b/app/src/main/java/com/nutomic/syncthingandroid/util/Util.java index 316923dc..32b64f8e 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/util/Util.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/util/Util.java @@ -20,8 +20,7 @@ import java.io.IOException; import java.io.File; import java.text.DecimalFormat; -import java.io.StringReader; -import java.util.Properties; +import java.io.UnsupportedEncodingException; import eu.chainfire.libsuperuser.Shell; @@ -142,19 +141,18 @@ public class Util { useRoot = true; } + // ToDo - For testing purposes only. absoluteFolderPath = "/storage/emulated/0/Папка"; - - Properties p = new Properties(); + byte absoluteFolderPathBytes[] = absoluteFolderPath.getBytes(); try { - p.load(new StringReader("key="+absoluteFolderPath)); - } catch(IOException e) { + absoluteFolderPath = new String(absoluteFolderPathBytes, "Cp1251"); + } catch(UnsupportedEncodingException e) { Log.e(TAG, "Error", e); } - absoluteFolderPath = p.getProperty("key"); // Write permission test file. String touchFile = absoluteFolderPath + "/" + TOUCH_FILE_NAME; - int exitCode = runShellCommand("mkdir -p \"" + absoluteFolderPath + "\"; echo \"\" > \"" + touchFile + "\"\n", useRoot); + int exitCode = runShellCommand("rm -f \"" + absoluteFolderPath + "\"; echo \"\" > \"" + touchFile + "\"\n", useRoot); if (exitCode != 0) { String error; switch (exitCode) {