mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-22 12:21:15 +00:00
Create syncthing folder on start if it does not exist.
This commit is contained in:
parent
92c30b55c1
commit
b091d430a8
2 changed files with 18 additions and 0 deletions
|
@ -4,7 +4,11 @@
|
|||
android:versionCode="1"
|
||||
android:versionName="0.1"
|
||||
android:debuggable="true" >
|
||||
|
||||
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" />
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
|
||||
<application android:label="@string/app_name" >
|
||||
<activity
|
||||
android:name="MainActivity"
|
||||
|
|
|
@ -2,11 +2,25 @@ package com.nutomic.syncthingandroid;
|
|||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
|
||||
private static final String TAG = "MainActivity";
|
||||
|
||||
private static final File SYNCTHING_FOLDER =
|
||||
new File(Environment.getExternalStorageDirectory(), "syncthing");
|
||||
|
||||
@Override public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (!SYNCTHING_FOLDER.isDirectory() && !SYNCTHING_FOLDER.mkdir()) {
|
||||
Log.w(TAG, "Failed to create syncthing folder on sdcard, exiting");
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
System.loadLibrary("syncthing");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue