Earlier version and logging initialization
This commit is contained in:
@@ -441,8 +441,18 @@ public class Vars implements Loadable{
|
||||
|
||||
settings.setAppName(appName);
|
||||
|
||||
loadFileLogger(settings.getDataDirectory().child("last_log.txt"));
|
||||
}
|
||||
|
||||
public static void loadFileLogger(Fi file){
|
||||
if(loadedFileLogger) return;
|
||||
|
||||
if(!file.parent().exists()){
|
||||
file.parent().mkdirs();
|
||||
}
|
||||
|
||||
try{
|
||||
Writer writer = settings.getDataDirectory().child("last_log.txt").writer(false);
|
||||
Writer writer = file.writer(false);
|
||||
LogHandler log = Log.logger;
|
||||
Log.logger = (level, text) -> {
|
||||
log.log(level, text);
|
||||
@@ -467,7 +477,7 @@ public class Vars implements Loadable{
|
||||
settings.setJson(JsonIO.json);
|
||||
settings.setAppName(appName);
|
||||
|
||||
if(steam || (Version.modifier != null && Version.modifier.contains("steam"))){
|
||||
if(steam || Version.isSteam){
|
||||
settings.setDataDirectory(Core.files.local("saves/"));
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@ public class Version{
|
||||
public static int build = 0;
|
||||
/** Revision number. Used for hotfixes. Does not affect server compatibility. */
|
||||
public static int revision = 0;
|
||||
/** Whether the Steam version of the game is requested. This is different from Vars.steam (Steam initialization can fail) */
|
||||
public static boolean isSteam = false;
|
||||
/** Whether version loading is enabled. */
|
||||
public static boolean enabled = true;
|
||||
|
||||
@@ -38,6 +40,7 @@ public class Version{
|
||||
modifier = map.get("modifier");
|
||||
commitHash = map.get("commitHash", "unknown");
|
||||
buildDate = map.get("buildDate", "unknown");
|
||||
isSteam = modifier.contains("steam");
|
||||
if(map.get("build").contains(".")){
|
||||
String[] split = map.get("build").split("\\.");
|
||||
try{
|
||||
|
||||
Reference in New Issue
Block a user