diff options
author | Arne Schwabe <arne@blinkt.de> | 2012-05-31 22:20:51 +0200 |
---|---|---|
committer | Arne Schwabe <arne@blinkt.de> | 2012-05-31 22:20:51 +0200 |
commit | d13c16392630354c7296c31b343720e0a0f0f571 (patch) | |
tree | 86ce66d4eaf621ea30e5c9fdaff7fb90a77d02ce /src/de/blinkt/openvpn/ConfigConverter.java | |
parent | 4a2f853dba829b6c3b582c9c2a0b1bab5d902d4a (diff) |
- fix a few more strings
- add editing xxx title to cfonig settings
Diffstat (limited to 'src/de/blinkt/openvpn/ConfigConverter.java')
-rw-r--r-- | src/de/blinkt/openvpn/ConfigConverter.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/de/blinkt/openvpn/ConfigConverter.java b/src/de/blinkt/openvpn/ConfigConverter.java index 8aebc664..5e0a6eb3 100644 --- a/src/de/blinkt/openvpn/ConfigConverter.java +++ b/src/de/blinkt/openvpn/ConfigConverter.java @@ -5,6 +5,8 @@ import java.io.FileInputStream; import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.util.List;
+import java.util.Vector;
import android.app.Activity;
import android.app.ListActivity;
@@ -24,6 +26,8 @@ public class ConfigConverter extends ListActivity { private VpnProfile mResult;
private ArrayAdapter<String> mArrayAdapter;
+ private List<String> mPathsegments;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -91,7 +95,20 @@ public class ConfigConverter extends ListActivity { // Try diffent path relative to /mnt/sdcard
File sdcard = Environment.getExternalStorageDirectory();
File root = new File("/");
- File[] dirlist = {root, sdcard};
+
+ Vector<File> dirlist = new Vector<File>();
+
+ for(int i=mPathsegments.size()-1;i >=0 ;i--){
+ String path = "";
+ for (int j = 0;j<=i;j++) {
+ path += "/" + mPathsegments.get(j);
+ }
+ dirlist.add(new File(path));
+ }
+ dirlist.add(sdcard);
+ dirlist.add(root);
+
+
String[] fileparts = filename.split("/");
for(File rootdir:dirlist){
String suffix="";
@@ -159,6 +176,8 @@ public class ConfigConverter extends ListActivity { log(R.string.importing_config,data.toString());
try {
InputStream is = getContentResolver().openInputStream(data);
+ mPathsegments = data.getPathSegments();
+
doImport(is);
} catch (FileNotFoundException e) {
log(R.string.import_content_resolve_error);
|