import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
if (j > -1) {
ext = filename.substring(j+1);
}
- // jvp files
- if (ext.equals("jvp")) {
+ // jvp files etc
+ boolean addedStartupFile = false; // only add one startup file
+ if (_app.startupFileExtensions.contains(ext.toLowerCase()) && ! addedStartupFile) {
File f = new File(filename);
if (f.exists()) {
_app.addStartupFile(f);
+ addedStartupFile = true;
}
}
// jvl files
- if (ext.equals("jvl")) {
- // Do stuff with the appbase here!
+ if (_app.locatorFileExtension.equals(ext.toLowerCase())) {
+ // Do something special with this here
+ File f = new File(filename);
+ if (f.exists()) {
+ String line = null;
+ try {
+ FileReader fr = new FileReader(f);
+ BufferedReader br = new BufferedReader(fr);
+ line = br.readLine();
+ br.close();
+ } catch(Exception e) {
+ log.warning("Something went wrong reading Jalview Version Locator file '"+filename+"'", e);
+ }
+ if (line != null) {
+ String urlString = line.trim();
+ try {
+ URL newAppbase = new URL(urlString);
+ _app.newAppbase(newAppbase);
+ } catch(MalformedURLException e) {
+ log.warning("Java Version Locator url '"+urlString+"' found in file '"+filename+"' is malformed", e);
+ }
+ }
+ }
}
}
}
protected static final int MAX_LOOPS = 5;
protected static final long FALLBACK_CHECK_TIME = 1000L;
+
}