Skip to content

Commit 48995fb

Browse files
author
jantje
committed
2 small fixes in regards to json files
json files were not deleted when removed from the json list json files with wrong filenames were silently ignored
1 parent 44d95ea commit 48995fb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

io.sloeber.core/src/io/sloeber/core/managers/Manager.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ static private void loadJson(String url, boolean forceDownload) {
254254
} else if (jsonFile.getName().toLowerCase().startsWith("library_")) { //$NON-NLS-1$
255255
LibraryManager.loadJson(jsonFile);
256256
}
257+
else {
258+
Common.log(new Status(IStatus.ERROR, Activator.getId(), "json files should start with \"package_\" or \"library_\" " + url+ " is ignored")); //$NON-NLS-1$ //$NON-NLS-2$
259+
}
257260
}
258261
}
259262

@@ -803,10 +806,10 @@ public static void setJsonURL(String[] newJsonUrls) {
803806
String curJsons[] = getJsonURLList();
804807
HashSet<String> origJsons = new HashSet<>(Arrays.asList(curJsons));
805808
HashSet<String> currentSelectedJsons = new HashSet<>(Arrays.asList(newJsonUrls));
806-
currentSelectedJsons.removeAll(origJsons);
809+
origJsons.removeAll(currentSelectedJsons);
807810
// remove the files from disk which were in the old lst but not in the
808811
// new one
809-
for (String curJson : currentSelectedJsons) {
812+
for (String curJson : origJsons) {
810813
File localFile = getLocalFileName(curJson);
811814
if (localFile.exists()) {
812815
localFile.delete();

0 commit comments

Comments
 (0)