Skip to content

Commit 9028e46

Browse files
committedJan 30, 2014
Simplify Pkg cache creation, actually link versioned cache directory on unix
1 parent c49b0d3 commit 9028e46

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed
 

‎base/pkg/cache.jl

+5-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Cache
33
import ..Git
44
using ..Types
55

6-
import ..Dir: pkgroot
6+
import ..Dir: pkgroot, path
77

88
path(pkg::String) = abspath(".cache", pkg)
99

@@ -16,17 +16,11 @@ function mkcachedir()
1616
@windows_only mkdir(cache)
1717
@unix_only begin
1818
rootcache = joinpath(realpath(pkgroot()), ".cache")
19-
if rootcache == cache
20-
mkdir(cache)
21-
elseif isdir(rootcache)
22-
try
23-
ln(rootcache, cache)
24-
catch
25-
mkdir(cache)
26-
end
27-
else
19+
if !isdir(rootcache)
2820
mkdir(rootcache)
29-
mkcachedir()
21+
end
22+
if rootcache != cache
23+
run(`ln -s $rootcache $cache`)
3024
end
3125
end
3226
end

0 commit comments

Comments
 (0)
Please sign in to comment.