mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-16 07:14:58 +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 final class BuildConfig {
|
||||||
public static final String VERSION = \"${version}\";
|
public static final String VERSION = \"${version}\";
|
||||||
public static final String GIT_HASH = \"${gitCommitHash()}\";
|
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();
|
String hash = buildConfig.getField("GIT_HASH").get(null).toString();
|
||||||
builder.append(hash);
|
builder.append(hash);
|
||||||
|
|
||||||
long timestamp = buildConfig.getField("COMMIT_TIMESTAMP").getLong(null);
|
String timestamp = buildConfig.getField("GIT_TIMESTAMP").get(null).toString();
|
||||||
if (timestamp > 0) {
|
long time = Long.parseLong(timestamp) * 1000;
|
||||||
builder.append(" (" + sf.format(new Date(timestamp * 1000)) + ")");
|
builder.append(" (" + sf.format(new Date(time)) + ")");
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Ignored
|
// Ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
if (builder.isEmpty()) {
|
if (builder.isEmpty()) {
|
||||||
return "Unknown";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user