Skip to content

Commit 13183b9

Browse files
committed
added base functions to get version details
1 parent 57ac508 commit 13183b9

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

java/src/processing/mode/java/JavaEditor.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,10 +887,25 @@ private boolean isReferenceDownloaded() {
887887
}
888888
*/
889889

890+
private String getReferenceDownloadUrl() {
891+
String versionName = Base.getVersionName();
892+
int revisionInt = Base.getRevision();
893+
String revision = String.valueOf(revisionInt);
894+
895+
if ("unspecified".equals(versionName) || revisionInt == Integer.MAX_VALUE) {
896+
return "https://github.com/processing/processing4/releases/download/processing-1300-4.4.0/processing-4.4.0-reference.zip";
897+
}
898+
899+
String url = String.format(
900+
"https://github.com/processing/processing4/releases/download/processing-%s-%s/processing-%s-reference.zip",
901+
revision, versionName, versionName);
902+
System.out.println("Generated URL: " + url);
903+
return url;
904+
}
890905

891906
private void downloadReference() {
892907
try {
893-
URL source = new URL(REFERENCE_URL_2);
908+
URL source = new URL(getReferenceDownloadUrl());
894909
HttpURLConnection conn = (HttpURLConnection) source.openConnection();
895910
HttpURLConnection.setFollowRedirects(true);
896911
conn.setConnectTimeout(15 * 1000);

0 commit comments

Comments
 (0)