[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] ensure existing files are deleted before upgrade



commit e8116f45422d44ebdf7a9b5133d3c506167d74ad
Author: Nathan Freitas <nathan@xxxxxxxxxxx>
Date:   Tue Apr 8 15:31:02 2014 -0400

    ensure existing files are deleted before upgrade
---
 .../android/service/TorResourceInstaller.java      |   26 +++++++-------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/org/torproject/android/service/TorResourceInstaller.java b/src/org/torproject/android/service/TorResourceInstaller.java
index 41e899c..ff1f2b0 100644
--- a/src/org/torproject/android/service/TorResourceInstaller.java
+++ b/src/org/torproject/android/service/TorResourceInstaller.java
@@ -47,51 +47,43 @@ public class TorResourceInstaller implements TorServiceConstants {
 		InputStream is;
         File outFile;
         
-        if (!installFolder.exists())
-        	installFolder.mkdirs();
+        installFolder.mkdirs();
         
-        Shell shell = Shell.startShell(new ArrayList<String>(),installFolder.getCanonicalPath());
+        Shell shell = Shell.startShell(new ArrayList<String>(),installFolder.getAbsolutePath());
         
 		is = context.getResources().openRawResource(R.raw.torrc);
 		outFile = new File(installFolder, TORRC_ASSET_KEY);
-		if (outFile.exists())
-			shell.add(new SimpleCommand("rm " + outFile.getCanonicalPath())).waitForFinish();
+		shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish();
 		streamToFile(is,outFile, false, false);
 
 		is = context.getResources().openRawResource(R.raw.torrctether);		
 		outFile = new File(installFolder, TORRC_TETHER_KEY);
-		if (outFile.exists())
-			shell.add(new SimpleCommand("rm " + outFile.getCanonicalPath())).waitForFinish();
+		shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish();
 		streamToFile(is, outFile, false, false);
 
 		is = context.getResources().openRawResource(R.raw.privoxy_config);
 		outFile = new File(installFolder, PRIVOXYCONFIG_ASSET_KEY);
-		if (outFile.exists())
-			shell.add(new SimpleCommand("rm " + outFile.getCanonicalPath())).waitForFinish();
+		shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish();
 		streamToFile(is,outFile, false, false);
 	
 		is = context.getResources().openRawResource(R.raw.tor);
 		outFile = new File(installFolder, TOR_ASSET_KEY);
-		if (outFile.exists())
-			shell.add(new SimpleCommand("rm " + outFile.getCanonicalPath())).waitForFinish();
+		shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish();
 		streamToFile(is,outFile, false, true);
 	
 		is = context.getResources().openRawResource(R.raw.privoxy);
 		outFile = new File(installFolder, PRIVOXY_ASSET_KEY);
-		if (outFile.exists())
-			shell.add(new SimpleCommand("rm " + outFile.getCanonicalPath())).waitForFinish();
+		shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish();
 		streamToFile(is,outFile, false, true);
 	
 		is = context.getResources().openRawResource(R.raw.obfsproxy);
 		outFile = new File(installFolder, OBFSPROXY_ASSET_KEY);
-		if (outFile.exists())
-			shell.add(new SimpleCommand("rm " + outFile.getCanonicalPath())).waitForFinish();
+		shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish();
 		streamToFile(is,outFile, false, true);
 		
 		is = context.getResources().openRawResource(R.raw.xtables);
 		outFile = new File(installFolder, IPTABLES_ASSET_KEY);
-		if (outFile.exists())
-			shell.add(new SimpleCommand("rm " + outFile.getCanonicalPath())).waitForFinish();
+		shell.add(new SimpleCommand("rm " + outFile.getAbsolutePath())).waitForFinish();
 		streamToFile(is,outFile, false, true);
 	
 		return true;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits