[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [orbot/master] ensure pluggable transports are updated and set to executable
commit 3bbf7a173849b06036be8dd63bb01655e7555055
Author: n8fr8 <nathan@xxxxxxxxxxx>
Date: Sat May 12 00:32:27 2018 -0400
ensure pluggable transports are updated and set to executable
---
.../service/util/OtherResourceInstaller.java | 24 +++++++++++-----------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/orbotservice/src/main/java/org/torproject/android/service/util/OtherResourceInstaller.java b/orbotservice/src/main/java/org/torproject/android/service/util/OtherResourceInstaller.java
index 9584e9b0..672d6411 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/util/OtherResourceInstaller.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/util/OtherResourceInstaller.java
@@ -65,27 +65,27 @@ public class OtherResourceInstaller implements TorServiceConstants {
public boolean installResources () throws IOException, FileNotFoundException, TimeoutException
{
- InputStream is;
File outFile;
- String cpuPath = "armeabi";
-
- if (Build.CPU_ABI.contains("x86"))
- cpuPath = "x86";
-
if (!installFolder.exists())
installFolder.mkdirs();
- // is = context.getAssets().open(cpuPath + '/' + OBFSCLIENT_ASSET_KEY + MP3_EXT);
- is = new FileInputStream(new File(getNativeLibraryDir(context),OBFSCLIENT_ASSET_KEY + ".so"));
+ File libBinary = new File(getNativeLibraryDir(context),OBFSCLIENT_ASSET_KEY + ".so");
outFile = new File(installFolder, OBFSCLIENT_ASSET_KEY);
- streamToFile(is,outFile, false, true);
+
+ if ((!outFile.exists()) || (libBinary.lastModified() > outFile.lastModified())) {
+ streamToFile(new FileInputStream(libBinary), outFile, false, true);
+ }
+
setExecutable(outFile);
-// is = context.getAssets().open(cpuPath + '/' + PDNSD_ASSET_KEY + MP3_EXT);
- is = new FileInputStream(new File(getNativeLibraryDir(context),PDNSD_ASSET_KEY + ".so"));
+ libBinary = new File(getNativeLibraryDir(context),PDNSD_ASSET_KEY + ".so");
outFile = new File(installFolder, PDNSD_ASSET_KEY);
- streamToFile(is,outFile, false, true);
+
+ if ((!outFile.exists()) || (libBinary.lastModified() > outFile.lastModified())) {
+ streamToFile(new FileInputStream(libBinary), outFile, false, true);
+ }
+
setExecutable(outFile);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits