mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-16 15:24:44 +01:00
Better fix for getting the commit timestamp
This commit is contained in:
@@ -192,7 +192,7 @@ package emu.lunarcore;
|
||||
public final class BuildConfig {
|
||||
public static final String VERSION = \"${version}\";
|
||||
public static final String GIT_HASH = \"${gitCommitHash()}\";
|
||||
public static final long COMMIT_TIMESTAMP = ${gitCommitTime()};
|
||||
public static final String GIT_TIMESTAMP = \"${gitCommitTime()}\";
|
||||
}
|
||||
"""
|
||||
}
|
||||
|
||||
@@ -228,16 +228,15 @@ public class LunarCore {
|
||||
String hash = buildConfig.getField("GIT_HASH").get(null).toString();
|
||||
builder.append(hash);
|
||||
|
||||
long timestamp = buildConfig.getField("COMMIT_TIMESTAMP").getLong(null);
|
||||
if (timestamp > 0) {
|
||||
builder.append(" (" + sf.format(new Date(timestamp * 1000)) + ")");
|
||||
}
|
||||
String timestamp = buildConfig.getField("GIT_TIMESTAMP").get(null).toString();
|
||||
long time = Long.parseLong(timestamp) * 1000;
|
||||
builder.append(" (" + sf.format(new Date(time)) + ")");
|
||||
} catch (Exception e) {
|
||||
// Ignored
|
||||
}
|
||||
|
||||
if (builder.isEmpty()) {
|
||||
return "Unknown";
|
||||
return "";
|
||||
} else {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user