File tree Expand file tree Collapse file tree 2 files changed +19
-206
lines changed
json-data-utils/src/main/java/net/minecraftforge/util/data Expand file tree Collapse file tree 2 files changed +19
-206
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 44 */
55package net .minecraftforge .util .data ;
66
7+ import net .minecraftforge .util .logging .SimpleLogger ;
78import org .jetbrains .annotations .Nullable ;
89
910import java .io .IOException ;
@@ -62,6 +63,7 @@ public String key() {
6263 if (value .key .equals (key ))
6364 return value ;
6465 }
66+
6567 return null ;
6668 }
6769
@@ -78,23 +80,24 @@ private static OS getCurrent() {
7880 String prop = System .getProperty ("os.name" ).toLowerCase (Locale .ENGLISH );
7981 for (OS os : $values ) {
8082 for (String key : os .names ) {
81- if (prop .contains (key )) {
82- if (os == LINUX ) {
83- try {
84- for (String line : Files .readAllLines (Paths .get ("/etc/os-release" ), StandardCharsets .UTF_8 )) {
85- line = line .toLowerCase (Locale .ENGLISH );
86- if (line .startsWith ("name=" ) && line .contains ("alpine" )) {
87- return ALPINE ;
88- }
89- }
90- } catch (IOException ignored ) {
91- // TODO log that we can't read /etc/os-release
92- }
93- }
94- return os ;
95- }
83+ if (!prop .contains (key )) continue ;
84+
85+ return os == LINUX ? getCurrentLinux () : os ;
9686 }
9787 }
9888 return UNKNOWN ;
9989 }
100- }
90+
91+ private static OS getCurrentLinux () {
92+ try {
93+ for (String line : Files .readAllLines (Paths .get ("/etc/os-release" ), StandardCharsets .UTF_8 )) {
94+ line = line .toLowerCase (Locale .ENGLISH );
95+ if (line .startsWith ("name=" ) && line .contains ("alpine" )) {
96+ return ALPINE ;
97+ }
98+ }
99+ } catch (IOException ignored ) { }
100+
101+ return LINUX ;
102+ }
103+ }
You can’t perform that action at this time.
0 commit comments