Skip to content

Commit

Permalink
Prefer properties from 'lipreading.properties' file that can be put i…
Browse files Browse the repository at this point in the history
…n the working directory
  • Loading branch information
dagansandler committed Jul 21, 2013
1 parent 5733f0b commit 423155e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lipreading-gui/src/main/java/edu/lipreading/gui/Constants.java
@@ -1,11 +1,11 @@
package edu.lipreading.gui;

import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import java.util.Properties;

public class Constants {
public static final Properties LIP_READING_PROPS = new Properties();

static {
InputStream is = ClassLoader.getSystemResourceAsStream("lr-gui.properties");
try {
Expand All @@ -14,7 +14,16 @@ public class Constants {
} catch (IOException e) {
throw new RuntimeException(e);
}


try {
is = new FileInputStream(new File("lipreading.properties"));
LIP_READING_PROPS.load(is);
is.close();
} catch (FileNotFoundException e) {
System.out.println("Can't find local properties file at: " + new File(".").getAbsolutePath());
} catch (IOException e) {
System.out.println("Error while reading properties file. Will use default properties");
}
}

public static final String LIP_IMAGE_FILE_PATH = LIP_READING_PROPS.getProperty("LIP_IMAGE_FILE_PATH");
Expand Down

0 comments on commit 423155e

Please sign in to comment.