import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
}
};
- public void setStartupFilesFromParameterString(String p) {
- String q = "\"";
- if (p != null && p.length() > 0) {
- String[] filenames;
- if (p.startsWith(q) && p.endsWith(q)) {
- filenames = p.substring(1,p.length()-1).split("\" \"");
- } else {
- filenames = new String[]{p};
- }
- for (int i = 0; i < filenames.length; i++) {
- String filename = filenames[i];
- String ext = null;
- int j = filename.lastIndexOf('.');
- if (j > -1) {
- ext = filename.substring(j+1);
- }
- // 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 (_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 Application _app;
protected Application.UpdateInterface _ifc = new Application.UpdateInterface(Config.EMPTY);