comparison 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
comparison
equal deleted inserted replaced
511:6dbddfa27f6c 512:e1dd1fd46e18
208 } 208 }
209 209
210 makingShortcut = Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction()) 210 makingShortcut = Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())
211 || Intent.ACTION_PICK.equals(getIntent().getAction()); 211 || Intent.ACTION_PICK.equals(getIntent().getAction());
212 212
213 // connect with hosts database, read deployment file, and populate list 213 // connect with hosts database, read connections file, and populate list
214 hostdb = new HostDatabase(this); 214 hostdb = new HostDatabase(this);
215 // build hosts from a deployment text file 215 // build hosts from a connections text file
216 Uri launch = createDeploymentHosts(); 216 Uri launch = createHostConnections();
217 updateList(); 217 updateList();
218 218
219 // check for eula agreement, which might be set from the deployment file 219 // check for eula agreement, which might be set from the deployment file
220 boolean agreed = prefs.getBoolean(PreferenceConstants.EULA, false); 220 boolean agreed = prefs.getBoolean(PreferenceConstants.EULA, false);
221 if (!agreed) { 221 if (!agreed) {
456 intent.setData(uri); 456 intent.setData(uri);
457 startActivity(intent); 457 startActivity(intent);
458 return true; 458 return true;
459 } 459 }
460 460
461 private Uri createDeploymentHosts() { 461 private Uri createHostConnections() {
462 Uri launch = null; 462 Uri launch = null;
463 try { 463 try {
464 boolean del = true; 464 boolean del = true;
465 int[] c = hostdb.getGlobalDefaultColors(); 465 int[] c = hostdb.getGlobalDefaultColors();
466 int fg = c[0]; 466 int fg = c[0];
467 int bg = c[1]; 467 int bg = c[1];
468 String fn = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath() + 468 String con = "/510Connectbot.connections";
469 File.separator + "deployment.connections"; 469 String external_dir = Environment.getExternalStorageDirectory().getAbsolutePath();
470 BufferedReader reader = new BufferedReader(new FileReader(fn)); 470 String accuspeech = "/AccuSpeech/VoiceProjects";
471 String download_dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
472 BufferedReader reader = null;
473 try {
474 reader = new BufferedReader(new FileReader(external_dir + accuspeech + con));
475 }
476 catch (Exception e) {
477 reader = new BufferedReader(new FileReader(download_dir + con));
478 }
471 String line = null; 479 String line = null;
472 480
473 while ((line = reader.readLine()) != null) { 481 while ((line = reader.readLine()) != null) {
474 if (line.length() == 0) continue; // empty 482 if (line.length() == 0) continue; // empty
475 483