Skip to content

Commit

Permalink
fixing up XML stuff for server
Browse files Browse the repository at this point in the history
  • Loading branch information
shiffman committed Nov 14, 2013
1 parent 59c4017 commit 2618da3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
File renamed without changes.
25 changes: 16 additions & 9 deletions Most-Pixels-Ever-Server/java/src/mpe/server/MPEServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.io.File;

public class MPEServer {

public static final String version = "2.0.2";

private HashMap<Integer,Connection> connectionlookup = new HashMap<Integer,Connection>();
Expand Down Expand Up @@ -50,8 +50,7 @@ public class MPEServer {

public boolean paused;

// TODO: What's the correct relative path for the default file?
public static final String defaultSettingsFile = "../data/settings.xml";
public static final String defaultSettingsFile = "settings.xml";

public void setFramerate(int fr){
if (fr > -1) frameRate = fr;
Expand Down Expand Up @@ -253,7 +252,7 @@ public void killServer() {
public static void main(String[] args) {

boolean help = false;

System.out.println("MPE SERVER VERSION: " + version);

/*
Expand Down Expand Up @@ -290,10 +289,18 @@ else if (args[i].contains("-verbose")) {
runArgs.put("verbose", "1");
}
else if (args[i].contains("-xml")) {
String settingsFile = args[i].substring(4);
// Remove double quotes from the filename
settingsFile = settingsFile.replaceAll("^\"|\"$", "");
runArgs.put("xml", settingsFile);
try {
String settingsFile = args[i+1];
if (settingsFile.charAt(0) == '-') {
System.out.println("No filename specified, using " + defaultSettingsFile);
runArgs.put("xml", defaultSettingsFile);
} else {
runArgs.put("xml", settingsFile);
}
} catch (Exception e) {
System.out.println("No filename specified, using " + defaultSettingsFile);
runArgs.put("xml", defaultSettingsFile);
}
}
else {
help = true;
Expand Down Expand Up @@ -338,7 +345,7 @@ else if (args[i].contains("-xml")) {
" * -framerate<framerate> Desired frame rate. Defaults to 30\n" +
" * -port<port number> Defines the port. Defaults to 9002\n" +
" * -verbose Turns debugging messages on.\n" +
" * -xml<path to file with XML settings> Path to initialization file. Defaults to \""+defaultSettingsFile+"\".\n");
" * -xml <path to file with XML settings> Path to initialization file. Defaults to \""+defaultSettingsFile+"\".\n");
System.exit(1);
}

Expand Down

0 comments on commit 2618da3

Please sign in to comment.