From ebdbb6c5d1f5e2f0f1c2d0ade9af77ff197aacf3 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Sun, 25 May 2014 22:24:41 +0200 Subject: [PATCH] Revert "Set home directory to sdcard instead of app data folder. Fixes #9." This reverts commit e3219ef80dac72346c65ad9c86f70b73eb2552df. This change seems to cause problems on Android 2.3 devices, which exit with error "No home directory found". I can't test this myself, and don't know if it happens for everyone (ref #9). --- .../syncthingandroid/service/SyncthingService.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java b/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java index 799710d2..b0aa9273 100644 --- a/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java +++ b/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java @@ -6,7 +6,6 @@ import android.app.Service; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; -import android.os.Environment; import android.os.IBinder; import android.support.v4.app.NotificationCompat; import android.util.Log; @@ -128,10 +127,9 @@ public class SyncthingService extends Service { try { Process p = Runtime.getRuntime().exec("sh"); dos = new DataOutputStream(p.getOutputStream()); - // Set home directory to sdcard (so the "create repo" hint makes sense) - dos.writeBytes("HOME=" + - Environment.getExternalStorageDirectory().toString() + "\n"); - // Set syncthing config folder to app data folder. + // Set home directory to data folder for syncthing to use. + dos.writeBytes("HOME=" + getApplicationInfo().dataDir + "\n"); + // Call syncthing with -home (as it would otherwise use "~/.config/syncthing/". dos.writeBytes(getApplicationInfo().dataDir + "/" + BINARY_NAME + " " + "-home " + getApplicationInfo().dataDir + "\n"); dos.writeBytes("exit\n"); @@ -140,7 +138,7 @@ public class SyncthingService extends Service { ret = p.waitFor(); // Write syncthing binary output to log. - // NOTE: This is only done on shutdown, not in real time. + // NOTE: This is only done on shutdown, not live. isr = new InputStreamReader(p.getInputStream()); BufferedReader stdout = new BufferedReader(isr); String line;