Permalink
Browse files

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/….
#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.
  • Loading branch information...
alexarchambault committed Oct 27, 2017
1 parent d27c0ee commit 07ad16da717c0f16d3795709e6b24b31a0ff4b83
Showing with 7 additions and 11 deletions.
  1. +1 −1 paths/src/main/java/coursier/CachePath.java
  2. +6 −10 paths/src/main/java/coursier/CoursierPaths.java
@@ -85,7 +85,7 @@ public static File lockFile(File file) {
}
public static File defaultCacheDirectory() {
return new File(CoursierPaths.cacheDirectory(), "v1");
return CoursierPaths.cacheDirectory();
}
private static ConcurrentHashMap<File, Object> processStructureLocks = new ConcurrentHashMap<File, Object>();
@@ -30,31 +30,27 @@ private static File computeCacheDirectory() {
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) {
path = xdgPath;
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() {

0 comments on commit 07ad16d

Please sign in to comment.