[tor-commits] [orbot/master] ensure pluggable transports are updated and set to executable

n8fr8 at torproject.org n8fr8 at torproject.org
Sat May 12 04:50:45 UTC 2018


commit 3bbf7a173849b06036be8dd63bb01655e7555055
Author: n8fr8 <nathan at freitas.net>
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);
 
 





More information about the tor-commits mailing list