Skip to content

Commit

Permalink
Save versions cache file in plugin's state location by default (#1312)
Browse files Browse the repository at this point in the history
  • Loading branch information
donat authored Jul 30, 2024
1 parent ad7850b commit c5918a1
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;

import org.eclipse.buildship.core.internal.CorePlugin;

/**
* Provides information about the Gradle versions available from services.gradle.org. The version information can optionally be cached on the local file system.
*
Expand Down Expand Up @@ -220,10 +222,10 @@ private static URL createURL(String url) {
private static File getCacheFile() {
// ensures compliance with XDG base spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
String xdgCache = System.getenv("XDG_CACHE_HOME");
if (xdgCache == null) {
xdgCache = System.getProperty("user.home") + "/.cache/";
if (xdgCache != null) {
return new File(xdgCache, "tooling/gradle/versions.json");
}
return new File(xdgCache, "tooling/gradle/versions.json");
return CorePlugin.getInstance().getStateLocation().append("gradle").append("versions.json").toFile();
}

/**
Expand Down

0 comments on commit c5918a1

Please sign in to comment.