@@ -59,28 +59,7 @@ public static String getCommandString(String project, String repo, String versio
59
59
60
60
HashMap <String , Object > database = gson .fromJson (jsonText , TT_mapStringString );
61
61
String key = "UNKNOWN" ;
62
- if (LatestFromGithubLaunchUI .isLin ()) {
63
- if (LatestFromGithubLaunchUI .isArm ()) {
64
- key = "Linux-aarch64" ;
65
- } else {
66
- key = "Linux-x64" ;
67
- }
68
- }
69
-
70
- if (LatestFromGithubLaunchUI .isMac ()) {
71
- if (LatestFromGithubLaunchUI .isArm ()) {
72
- key = "Mac-aarch64" ;
73
- } else {
74
- key = "Mac-x64" ;
75
- }
76
- }
77
- if (LatestFromGithubLaunchUI .isWin ()) {
78
- if (LatestFromGithubLaunchUI .isArm ()) {
79
- key = "UNKNOWN" ;
80
- } else {
81
- key = "Windows-x64" ;
82
- }
83
- }
62
+ key = discoverKey (key );
84
63
Map <String , Object > vm = (Map <String , Object >) database .get (key );
85
64
String baseURL = vm .get ("url" ).toString ();
86
65
String type = vm .get ("type" ).toString ();
@@ -111,12 +90,39 @@ public static String getCommandString(String project, String repo, String versio
111
90
return cmd + " -jar " ;
112
91
}
113
92
114
- public static boolean isExecutable (ZipArchiveEntry entry ) {
115
- int unixMode = entry .getUnixMode ();
116
- // Check if any of the executable bits are set for user, group, or others.
117
- // User executable: 0100 (0x40), Group executable: 0010 (0x10), Others executable: 0001 (0x01)
118
- return (unixMode & 0x49 ) != 0 ;
119
- }
93
+ private static String discoverKey (String key ) {
94
+ if (LatestFromGithubLaunchUI .isLin ()) {
95
+ if (LatestFromGithubLaunchUI .isArm ()) {
96
+ key = "Linux-aarch64" ;
97
+ } else {
98
+ key = "Linux-x64" ;
99
+ }
100
+ }
101
+
102
+ if (LatestFromGithubLaunchUI .isMac ()) {
103
+ if (LatestFromGithubLaunchUI .isArm ()) {
104
+ key = "Mac-aarch64" ;
105
+ } else {
106
+ key = "Mac-x64" ;
107
+ }
108
+ }
109
+ if (LatestFromGithubLaunchUI .isWin ()) {
110
+ if (LatestFromGithubLaunchUI .isArm ()) {
111
+ key = "UNKNOWN" ;
112
+ } else {
113
+ key = "Windows-x64" ;
114
+ }
115
+ }
116
+ return key ;
117
+ }
118
+
119
+ public static boolean isExecutable (ZipArchiveEntry entry ) {
120
+ int unixMode = entry .getUnixMode ();
121
+ // Check if any of the executable bits are set for user, group, or others.
122
+ // User executable: 0100 (0x40), Group executable: 0010 (0x10), Others
123
+ // executable: 0001 (0x01)
124
+ return (unixMode & 0x49 ) != 0 ;
125
+ }
120
126
private static void unzip (File path , String dir ) throws Exception {
121
127
String fileBaseName = FilenameUtils .getBaseName (path .getName ().toString ());
122
128
Path destFolderPath = new File (dir ).toPath ();
0 commit comments