diff app/src/main/java/com/five_ten_sg/connectbot/HostListActivity.java @ 512:e1dd1fd46e18

change connections file name and look for it in the accuspeech voice projects directory, then the downloads directory
author Carl Byington <carl@five-ten-sg.com>
date Fri, 10 Feb 2023 14:32:41 -0700
parents aee5f34cc2db
children 13a922d1fc5c
line wrap: on
line diff
--- a/app/src/main/java/com/five_ten_sg/connectbot/HostListActivity.java	Fri Feb 10 13:42:14 2023 -0700
+++ b/app/src/main/java/com/five_ten_sg/connectbot/HostListActivity.java	Fri Feb 10 14:32:41 2023 -0700
@@ -210,10 +210,10 @@
         makingShortcut = Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())
                          || Intent.ACTION_PICK.equals(getIntent().getAction());
 
-        // connect with hosts database, read deployment file,  and populate list
+        // connect with hosts database, read connections file,  and populate list
         hostdb = new HostDatabase(this);
-        // build hosts from a deployment text file
-        Uri launch = createDeploymentHosts();
+        // build hosts from a connections text file
+        Uri launch = createHostConnections();
         updateList();
 
         // check for eula agreement, which might be set from the deployment file
@@ -458,16 +458,24 @@
         return true;
     }
 
-    private Uri createDeploymentHosts() {
+    private Uri createHostConnections() {
         Uri launch = null;
         try {
             boolean del = true;
             int[] c = hostdb.getGlobalDefaultColors();
             int fg = c[0];
             int bg = c[1];
-            String fn = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() +
-                        File.separator + "deployment.connections";
-            BufferedReader reader = new BufferedReader(new FileReader(fn));
+            String con = "/510Connectbot.connections";
+            String external_dir = Environment.getExternalStorageDirectory().getAbsolutePath();
+            String accuspeech   = "/AccuSpeech/VoiceProjects";
+            String download_dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
+            BufferedReader reader = null;
+            try {
+                reader = new BufferedReader(new FileReader(external_dir + accuspeech + con));
+            }
+            catch (Exception e) {
+                reader = new BufferedReader(new FileReader(download_dir + con));
+            }
             String line = null;
 
             while ((line = reader.readLine()) != null) {