Skip to content

Commit c0410c4

Browse files
authored
在日志中记录 PROCESSOR_IDENTIFIER (#3619)
1 parent da93b4c commit c0410c4

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

Diff for: HMCL/src/main/java/org/jackhuang/hmcl/Launcher.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,11 @@ public static void main(String[] args) {
225225
LOG.info("Operating System: " + (OperatingSystem.OS_RELEASE_PRETTY_NAME == null
226226
? OperatingSystem.SYSTEM_NAME + ' ' + OperatingSystem.SYSTEM_VERSION
227227
: OperatingSystem.OS_RELEASE_PRETTY_NAME + " (" + OperatingSystem.SYSTEM_NAME + ' ' + OperatingSystem.SYSTEM_VERSION + ')'));
228-
LOG.info("System Architecture: " + Architecture.SYSTEM_ARCH_NAME);
229-
LOG.info("Java Architecture: " + Architecture.CURRENT_ARCH_NAME);
228+
if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
229+
LOG.info("Processor Identifier: " + System.getenv("PROCESSOR_IDENTIFIER"));
230+
}
231+
LOG.info("System Architecture: " + Architecture.SYSTEM_ARCH.getDisplayName());
232+
LOG.info("Java Architecture: " + Architecture.CURRENT_ARCH.getDisplayName());
230233
LOG.info("Java Version: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor"));
231234
LOG.info("Java VM Version: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor"));
232235
LOG.info("Java Home: " + System.getProperty("java.home"));
@@ -245,7 +248,6 @@ public static void main(String[] args) {
245248
LOG.info("XDG Session Type: " + System.getenv("XDG_SESSION_TYPE"));
246249
LOG.info("XDG Current Desktop: " + System.getenv("XDG_CURRENT_DESKTOP"));
247250
}
248-
249251
launch(Launcher.class, args);
250252
} catch (Throwable e) { // Fucking JavaFX will suppress the exception and will break our crash reporter.
251253
CRASH_REPORTER.uncaughtException(Thread.currentThread(), e);

Diff for: HMCL/src/main/java/org/jackhuang/hmcl/countly/CrashReport.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ public String getDisplayText() {
4343
stackTrace + "\n\n" +
4444
"-- System Details --\n" +
4545
" Operating System: " + OperatingSystem.SYSTEM_NAME + ' ' + OperatingSystem.SYSTEM_VERSION + "\n" +
46-
" System Architecture: " + Architecture.SYSTEM_ARCH_NAME + "\n" +
47-
" Java Architecture: " + Architecture.CURRENT_ARCH_NAME + "\n" +
46+
" System Architecture: " + Architecture.SYSTEM_ARCH.getDisplayName() + "\n" +
47+
" Java Architecture: " + Architecture.CURRENT_ARCH.getDisplayName() + "\n" +
4848
" Java Version: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor") + "\n" +
4949
" Java VM Version: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor") + "\n" +
5050
" JVM Max Memory: " + Runtime.getRuntime().maxMemory() + "\n" +

Diff for: HMCLCore/src/main/java/org/jackhuang/hmcl/util/platform/Architecture.java

+2-11
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ public boolean isX86() {
8585
return this == X86 || this == X86_64;
8686
}
8787

88-
public static final String CURRENT_ARCH_NAME;
89-
public static final String SYSTEM_ARCH_NAME;
9088
public static final Architecture CURRENT_ARCH;
9189
public static final Architecture SYSTEM_ARCH;
9290

@@ -192,8 +190,7 @@ public static Architecture parseArchName(String value) {
192190
}
193191

194192
static {
195-
CURRENT_ARCH_NAME = System.getProperty("os.arch");
196-
CURRENT_ARCH = parseArchName(CURRENT_ARCH_NAME);
193+
CURRENT_ARCH = parseArchName(System.getProperty("os.arch"));
197194

198195
String sysArchName = null;
199196
if (OperatingSystem.CURRENT_OS == OperatingSystem.WINDOWS) {
@@ -219,12 +216,6 @@ public static Architecture parseArchName(String value) {
219216
}
220217

221218
Architecture sysArch = parseArchName(sysArchName);
222-
if (sysArch == UNKNOWN) {
223-
SYSTEM_ARCH_NAME = CURRENT_ARCH_NAME;
224-
SYSTEM_ARCH = CURRENT_ARCH;
225-
} else {
226-
SYSTEM_ARCH_NAME = sysArchName;
227-
SYSTEM_ARCH = sysArch;
228-
}
219+
SYSTEM_ARCH = sysArch == UNKNOWN ? CURRENT_ARCH : sysArch;
229220
}
230221
}

0 commit comments

Comments
 (0)