This repository was archived by the owner on Apr 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +24
-17
lines changed
core/src/main/java/io/javaoperatorsdk/jenvtest/binary Expand file tree Collapse file tree 1 file changed +24
-17
lines changed Original file line number Diff line number Diff line change 1
1
package io .javaoperatorsdk .jenvtest .binary ;
2
2
3
3
public class OSInfo {
4
+ private final String os ;
5
+ private final String arch ;
4
6
5
- public String getOSName () {
6
- String os = System .getProperty ("os.name" ).toLowerCase ();
7
+ public OSInfo () {
8
+ final var osArch = System .getProperty ("os.arch" ).toLowerCase ();
9
+ switch (osArch ) {
10
+ case "ppc64" :
11
+ arch = "ppc64le" ;
12
+ break ;
13
+ case "aarch64" :
14
+ arch = "arm64" ;
15
+ break ;
16
+ default :
17
+ arch = "amd64" ;
18
+ }
19
+
20
+ final var os = System .getProperty ("os.name" ).toLowerCase ();
7
21
if (os .contains ("win" )) {
8
- return "windows" ;
22
+ this . os = "windows" ;
9
23
} else if (os .contains ("mac" )) {
10
- return "darwin" ;
24
+ this . os = "darwin" ;
11
25
} else {
12
- return os ;
26
+ this . os = os ;
13
27
}
14
28
}
15
29
16
- /**
17
- * Only amd64 and ppc64 binaries available.
18
- *
19
- * @return ppc64le if on that architecture otherwise amd64.
20
- */
21
- public String getOSArch () {
22
- var osArch = System .getProperty ("os.arch" ).toLowerCase ();
23
- if (osArch .contains ("ppc64" )) {
24
- return "ppc64le" ;
25
- } else {
26
- return "amd64" ;
27
- }
30
+ public String getOSName () {
31
+ return os ;
28
32
}
29
33
34
+ public String getOSArch () {
35
+ return arch ;
36
+ }
30
37
}
You can’t perform that action at this time.
0 commit comments