JAL-3633 refactored/simplified LaunchUtils code
[jalview.git] / getdown / src / getdown / core / src / main / java / jalview / util / ChannelProperties.java
index cf3b190..40f6110 100644 (file)
@@ -1,6 +1,9 @@
 package jalview.util;
 
 import java.awt.Image;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
@@ -122,14 +125,22 @@ public class ChannelProperties
     }
   }
 
-  public static void loadProps(InputStream is)
+  protected static void loadProps(File dir)
   {
-    try
+    File channelPropsFile = new File(dir, CHANNEL_PROPERTIES_FILENAME);
+    if (channelPropsFile.exists())
     {
-      channelProps.load(is);
-    } catch (IOException e)
-    {
-      System.err.println(e.getMessage());
+      try
+      {
+        InputStream is = new FileInputStream(channelPropsFile);
+        channelProps.load(is);
+      } catch (FileNotFoundException e)
+      {
+        System.err.println(e.getMessage());
+      } catch (IOException e)
+      {
+        System.err.println(e.getMessage());
+      }
     }
   }