mirror of https://github.com/sbt/sbt.git
Tweak v1 component handling in cache path
Up to coursier 1.0.0-RC12, setting COURSIER_CACHE=foo makes files land in e.g. foo/https/repo1.maven.org/…. https://github.com/coursier/coursier/pull/676 changed that to foo/v1/https/…. This commit reverts things back to what they were before that. In the long term, it would be better to keep the v1 component there, but I'd prefer not to change that behavior right now.
This commit is contained in:
parent
d27c0ee46e
commit
07ad16da71
|
|
@ -85,7 +85,7 @@ public class CachePath {
|
|||
}
|
||||
|
||||
public static File defaultCacheDirectory() {
|
||||
return new File(CoursierPaths.cacheDirectory(), "v1");
|
||||
return CoursierPaths.cacheDirectory();
|
||||
}
|
||||
|
||||
private static ConcurrentHashMap<File, Object> processStructureLocks = new ConcurrentHashMap<File, Object>();
|
||||
|
|
|
|||
|
|
@ -30,18 +30,19 @@ public final class CoursierPaths {
|
|||
if (path == null)
|
||||
path = System.getProperty("coursier.cache");
|
||||
|
||||
String xdgPath = coursierDirectories.projectCacheDir;
|
||||
File xdgDir = new File(xdgPath);
|
||||
File baseXdgDir = new File(coursierDirectories.projectCacheDir);
|
||||
File xdgDir = new File(baseXdgDir, "v1");
|
||||
String xdgPath = xdgDir.getAbsolutePath();
|
||||
|
||||
if (path == null) {
|
||||
if (xdgDir.isDirectory())
|
||||
if (baseXdgDir.isDirectory())
|
||||
path = xdgPath;
|
||||
}
|
||||
|
||||
if (path == null) {
|
||||
File coursierDotFile = new File(System.getProperty("user.home") + "/.coursier");
|
||||
if (coursierDotFile.isDirectory())
|
||||
path = System.getProperty("user.home") + "/.coursier/cache/";
|
||||
path = System.getProperty("user.home") + "/.coursier/cache/v1/";
|
||||
}
|
||||
|
||||
if (path == null) {
|
||||
|
|
@ -49,12 +50,7 @@ public final class CoursierPaths {
|
|||
xdgDir.mkdirs();
|
||||
}
|
||||
|
||||
File coursierCacheDirectory = new File(path).getAbsoluteFile();
|
||||
|
||||
if (coursierCacheDirectory.getName().equals("v1"))
|
||||
coursierCacheDirectory = coursierCacheDirectory.getParentFile();
|
||||
|
||||
return coursierCacheDirectory;
|
||||
return new File(path).getAbsoluteFile();
|
||||
}
|
||||
|
||||
public static File cacheDirectory() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue