mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-22 00:59:08 +01:00
android - dont rewrite files from assets if they exist
This commit is contained in:
parent
f1fb42460a
commit
d009a29426
1 changed files with 50 additions and 52 deletions
|
@ -36,7 +36,6 @@ public class I2PDActivity extends Activity {
|
||||||
|
|
||||||
private final DaemonSingleton.StateUpdateListener daemonStateUpdatedListener =
|
private final DaemonSingleton.StateUpdateListener daemonStateUpdatedListener =
|
||||||
new DaemonSingleton.StateUpdateListener() {
|
new DaemonSingleton.StateUpdateListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void daemonStateUpdate()
|
public void daemonStateUpdate()
|
||||||
{
|
{
|
||||||
|
@ -48,7 +47,7 @@ public class I2PDActivity extends Activity {
|
||||||
assetsCopied = true;
|
assetsCopied = true;
|
||||||
copyAsset("certificates");
|
copyAsset("certificates");
|
||||||
copyAsset("i2pd.conf");
|
copyAsset("i2pd.conf");
|
||||||
copyAsset("subsciptions.txt");
|
copyAsset("subscriptions.txt");
|
||||||
copyAsset("tunnels.conf");
|
copyAsset("tunnels.conf");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +73,7 @@ public class I2PDActivity extends Activity {
|
||||||
(DaemonSingleton.State.startFailed.equals(state)?": "+daemon.getDaemonStartResult():"")+
|
(DaemonSingleton.State.startFailed.equals(state)?": "+daemon.getDaemonStartResult():"")+
|
||||||
(DaemonSingleton.State.gracefulShutdownInProgress.equals(state)?": "+formatGraceTimeRemaining()+" "+getText(R.string.remaining):"")
|
(DaemonSingleton.State.gracefulShutdownInProgress.equals(state)?": "+formatGraceTimeRemaining()+" "+getText(R.string.remaining):"")
|
||||||
);
|
);
|
||||||
} catch (Throwable tr) {
|
} catch (Throwable tr) {
|
||||||
Log.e(TAG,"error ignored",tr);
|
Log.e(TAG,"error ignored",tr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,7 +171,6 @@ public class I2PDActivity extends Activity {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private static volatile boolean mIsBound;
|
private static volatile boolean mIsBound;
|
||||||
|
|
||||||
private void doBindService() {
|
private void doBindService() {
|
||||||
|
@ -340,7 +338,7 @@ public class I2PDActivity extends Activity {
|
||||||
for (String entry : contents) {
|
for (String entry : contents) {
|
||||||
copyAsset(path + "/" + entry);
|
copyAsset(path + "/" + entry);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
copyFileAsset(path);
|
copyFileAsset(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -354,7 +352,7 @@ public class I2PDActivity extends Activity {
|
||||||
*/
|
*/
|
||||||
private void copyFileAsset(String path) {
|
private void copyFileAsset(String path) {
|
||||||
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/i2pd/", path);
|
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/i2pd/", path);
|
||||||
try {
|
if(!file.exists()) try {
|
||||||
InputStream in = getAssets().open(path);
|
InputStream in = getAssets().open(path);
|
||||||
OutputStream out = new FileOutputStream(file);
|
OutputStream out = new FileOutputStream(file);
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
|
@ -365,7 +363,7 @@ public class I2PDActivity extends Activity {
|
||||||
}
|
}
|
||||||
out.close();
|
out.close();
|
||||||
in.close();
|
in.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "", e);
|
Log.e(TAG, "", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue