Fixing issues on other computers.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
|
||||
public class ApplicationConfiguration {
|
||||
private static Logger LOGGER = Logger.getLogger(ApplicationConfiguration.class);
|
||||
private static Properties _properties;
|
||||
private static File _root;
|
||||
|
||||
private synchronized static Properties getProperties() {
|
||||
if (_properties == null) {
|
||||
Properties props = new Properties();
|
||||
try {
|
||||
props.load(ApplicationConfiguration.class.getResourceAsStream("/gemp-lotr.properties"));
|
||||
_properties = props;
|
||||
} catch (Exception exp) {
|
||||
LOGGER.error("Can't load application configuration", exp);
|
||||
throw new RuntimeException("Unable to load application configuration", exp);
|
||||
}
|
||||
}
|
||||
return _properties;
|
||||
}
|
||||
|
||||
public static String getProperty(String property) {
|
||||
return getProperties().getProperty(property);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.gempukku.lotro.common;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
|
||||
public class ApplicationRoot {
|
||||
private static Logger LOGGER = Logger.getLogger(ApplicationRoot.class);
|
||||
private static File _root;
|
||||
|
||||
public synchronized static File getRoot() {
|
||||
if (_root == null) {
|
||||
Properties props = new Properties();
|
||||
try {
|
||||
props.load(ApplicationRoot.class.getResourceAsStream("/gemp-lotr.properties"));
|
||||
_root = new File(props.getProperty("application.root"));
|
||||
LOGGER.debug("Application root is: "+_root.getAbsolutePath());
|
||||
} catch (Exception exp) {
|
||||
LOGGER.error("Can't find application root", exp);
|
||||
throw new RuntimeException("Unable to load gemp-lotr.properties");
|
||||
}
|
||||
}
|
||||
return _root;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,9 @@
|
||||
## Application root, used for example for storing replay files
|
||||
application.root=/etc/gemp-lotr
|
||||
## My home location
|
||||
#application.root=i:\gemp-lotr
|
||||
|
||||
## DB connection
|
||||
db.connection.class=org.gjt.mm.mysql.Driver
|
||||
db.connection.url=jdbc:mysql://localhost/gemp-lotr
|
||||
db.connection.username=gemp-lotr
|
||||
db.connection.password=gemp-lotr
|
||||
db.connection.validateQuery=/* ping */ select 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.gempukku.lotro.game;
|
||||
|
||||
import com.gempukku.lotro.common.ApplicationRoot;
|
||||
import com.gempukku.lotro.common.ApplicationConfiguration;
|
||||
import com.gempukku.lotro.game.state.EventSerializer;
|
||||
import com.gempukku.lotro.game.state.GameEvent;
|
||||
import com.gempukku.lotro.game.state.GatheringParticipantCommunicationChannel;
|
||||
@@ -71,7 +71,7 @@ public class GameRecorder {
|
||||
}
|
||||
|
||||
private File getRecordingFile(String playerId, String gameId) {
|
||||
File gameReplayFolder = new File(ApplicationRoot.getRoot(), "replay");
|
||||
File gameReplayFolder = new File(ApplicationConfiguration.getProperty("application.root"), "replay");
|
||||
File playerReplayFolder = new File(gameReplayFolder, playerId);
|
||||
return new File(playerReplayFolder, gameId + ".xml.gz");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user