summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/VPNLaunchHelper.java
diff options
context:
space:
mode:
authorSean Leonard <meanderingcode@aetherislands.net>2013-01-22 22:26:08 -0700
committerSean Leonard <meanderingcode@aetherislands.net>2013-01-22 22:26:08 -0700
commit2bb6e8c9a956c56658807c7f2d25ab850243bbe6 (patch)
tree9e3a2e318d0503b33d94514836b8a9bc2db8aaa6 /src/de/blinkt/openvpn/VPNLaunchHelper.java
parent613543d9c00e607f25e7f745a60fb4e3ec3b5148 (diff)
Start rebranding: a whole lotta string replacement, moving src/ file tree
Diffstat (limited to 'src/de/blinkt/openvpn/VPNLaunchHelper.java')
-rw-r--r--src/de/blinkt/openvpn/VPNLaunchHelper.java74
1 files changed, 0 insertions, 74 deletions
diff --git a/src/de/blinkt/openvpn/VPNLaunchHelper.java b/src/de/blinkt/openvpn/VPNLaunchHelper.java
deleted file mode 100644
index 8389462a..00000000
--- a/src/de/blinkt/openvpn/VPNLaunchHelper.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package de.blinkt.openvpn;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Build;
-
-public class VPNLaunchHelper {
- static private boolean writeMiniVPN(Context context) {
- File mvpnout = new File(context.getCacheDir(),VpnProfile.MINIVPN);
- if (mvpnout.exists() && mvpnout.canExecute())
- return true;
-
- IOException e2 = null;
-
- try {
- InputStream mvpn;
-
- try {
- mvpn = context.getAssets().open("minivpn." + Build.CPU_ABI);
- }
- catch (IOException errabi) {
- OpenVPN.logInfo("Failed getting assets for archicture " + Build.CPU_ABI);
- e2=errabi;
- mvpn = context.getAssets().open("minivpn." + Build.CPU_ABI2);
-
- }
-
-
- FileOutputStream fout = new FileOutputStream(mvpnout);
-
- byte buf[]= new byte[4096];
-
- int lenread = mvpn.read(buf);
- while(lenread> 0) {
- fout.write(buf, 0, lenread);
- lenread = mvpn.read(buf);
- }
- fout.close();
-
- if(!mvpnout.setExecutable(true)) {
- OpenVPN.logMessage(0, "","Failed to set minivpn executable");
- return false;
- }
-
-
- return true;
- } catch (IOException e) {
- if(e2!=null)
- OpenVPN.logMessage(0, "",e2.getLocalizedMessage());
- OpenVPN.logMessage(0, "",e.getLocalizedMessage());
- e.printStackTrace();
- return false;
- }
- }
-
-
- public static void startOpenVpn(VpnProfile startprofile, Context context) {
- if(!writeMiniVPN(context)) {
- OpenVPN.logMessage(0, "", "Error writing minivpn binary");
- return;
- }
- OpenVPN.logMessage(0, "", context.getString(R.string.building_configration));
-
- Intent startVPN = startprofile.prepareIntent(context);
- if(startVPN!=null)
- context.startService(startVPN);
-
- }
-}