mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 03:11:30 +00:00
Set home directory to sdcard instead of app data folder. Fixes #9.
This commit is contained in:
parent
7576e2a47d
commit
e3219ef80d
1 changed files with 6 additions and 4 deletions
|
@ -5,6 +5,7 @@ import android.app.PendingIntent;
|
|||
import android.app.Service;
|
||||
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;
|
||||
|
@ -84,9 +85,10 @@ public class SyncthingService extends Service {
|
|||
try {
|
||||
Process p = Runtime.getRuntime().exec("sh");
|
||||
dos = new DataOutputStream(p.getOutputStream());
|
||||
// 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/".
|
||||
// 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.
|
||||
dos.writeBytes(getApplicationInfo().dataDir + "/" + BINARY_NAME + " " +
|
||||
"-home " + getApplicationInfo().dataDir + "\n");
|
||||
dos.writeBytes("exit\n");
|
||||
|
@ -95,7 +97,7 @@ public class SyncthingService extends Service {
|
|||
ret = p.waitFor();
|
||||
|
||||
// Write syncthing binary output to log.
|
||||
// NOTE: This is only done on shutdown, not live.
|
||||
// NOTE: This is only done on shutdown, not in real time.
|
||||
isr = new InputStreamReader(p.getInputStream());
|
||||
BufferedReader stdout = new BufferedReader(isr);
|
||||
String line;
|
||||
|
|
Loading…
Reference in a new issue