Skip to content

Commit fed3d46

Browse files
committed
#13 add the
gitcache zip download process
1 parent fcaa104 commit fed3d46

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

CaDoodleUpdater/src/main/java/com/commonwealthrobotics/CadoodleUpdater.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class CadoodleUpdater {
4949
public static String myVersionString = null;
5050
public static long sizeOfJar = 0;
5151
public static long sizeOfJson = 0;
52+
public static long sizeOfZip = 0;
5253
@FXML // ResourceBundle that was given to the FXMLLoader
5354
private ResourceBundle resources;
5455

@@ -84,6 +85,7 @@ public class CadoodleUpdater {
8485

8586
private static String downloadJarURL;
8687
private static String downloadJsonURL;
88+
private static String downloadZip;
8789

8890
public static String repoName;
8991
public static String jarName;
@@ -163,7 +165,7 @@ public void launchApplication() {
163165
new Thread(() -> {
164166
String command;
165167
try {
166-
command = JvmManager.getCommandString(project, repoName, myVersionString,downloadJsonURL,sizeOfJson,progress,bindir,infoBar);
168+
command = JvmManager.getCommandString(project, repoName, myVersionString,downloadJsonURL, downloadZip,sizeOfZip,sizeOfJson,progress,bindir,infoBar);
167169
} catch (Exception e) {
168170
// TODO Auto-generated catch block
169171
e.printStackTrace();
@@ -361,6 +363,10 @@ public static void readCurrentVersion(String url) throws IOException {
361363
downloadJsonURL = (String) key.get("browser_download_url");
362364
sizeOfJson = ((Double) key.get("size")).longValue();
363365
System.out.println(downloadJsonURL + " Size " + sizeOfJson + " bytes");
366+
}if (string.contentEquals("gitcache.zip")) {
367+
downloadZip = (String) key.get("browser_download_url");
368+
sizeOfZip = ((Double) key.get("size")).longValue();
369+
System.out.println(downloadZip + " Size " + sizeOfZip + " bytes");
364370
}else
365371
System.out.println(string+" is not jvm.json");
366372

CaDoodleUpdater/src/main/java/com/commonwealthrobotics/JvmManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class JvmManager {
5252
private static Label infoBar;
5353

5454
public static String getCommandString(String project, String repo, String version, String downloadJsonURL,
55-
long sizeOfJson, ProgressBar progress, String bindir, Label info) throws Exception {
55+
String downloadZip, long sizeOfZip, long sizeOfJson, ProgressBar progress, String bindir, Label info) throws Exception {
5656
if (version == null)
5757
version = "0.0.6";
5858
infoBar=info;
@@ -61,7 +61,7 @@ public static String getCommandString(String project, String repo, String versio
6161
File dest;
6262
try {
6363
exe = download(version, downloadJsonURL, sizeOfJson, progress, bindir, "jvm.json");
64-
download(version, downloadJsonURL, sizeOfJson, progress, bindir, "gitcache.zip");
64+
download(version, downloadZip, sizeOfZip, progress, bindir, "gitcache.zip");
6565
Type TT_mapStringString = new TypeToken<HashMap<String, Object>>() {
6666
}.getType();
6767
// chreat the gson object, this is the parsing factory
@@ -100,7 +100,7 @@ public static String getCommandString(String project, String repo, String versio
100100
System.out.println("Failed the extract, erasing and re-downloading");
101101
jvmArchive.delete();
102102
ex.printStackTrace();
103-
return getCommandString(project, repo, version, downloadJsonURL, sizeOfJson, progress, bindir,info);
103+
return getCommandString(project, repo, version, downloadJsonURL, downloadZip, sizeOfZip, sizeOfJson, progress, bindir,info);
104104
}
105105
}
106106
if (type.toLowerCase().contains("tar.gz")) {

0 commit comments

Comments
 (0)