Skip to content

Commit 5eaeac5

Browse files
authored
improve file comparison on weird filesystems (#167)
Co-authored-by: Christopher Doris <github.com/cjdoris>
1 parent b076646 commit 5eaeac5

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

src/resolve.jl

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,33 @@ function _resolve_env_is_clean(conda_env, meta)
2626
false
2727
end
2828

29+
function issamefile(file1, file2)
30+
ok1 = ispath(file1)
31+
ok2 = ispath(file2)
32+
if !ok1 && !ok2
33+
# both files don't exist, which is the same in a sense
34+
return true
35+
elseif ok1 && ok2
36+
# both files exist, so check if they are the same
37+
return samefile(file1, file2)
38+
else
39+
# if one exists and the other doesn't, they are not the same
40+
return false
41+
end
42+
end
43+
44+
function issameloadpath(load_path1, load_path2)
45+
if length(load_path1) != length(load_path2)
46+
return false
47+
end
48+
for (p1, p2) in zip(load_path1, load_path2)
49+
if !issamefile(p1, p2)
50+
return false
51+
end
52+
end
53+
return true
54+
end
55+
2956
function _resolve_can_skip_1(conda_env, load_path, meta_file)
3057
if !isdir(conda_env)
3158
@debug "conda env does not exist" conda_env
@@ -44,11 +71,11 @@ function _resolve_can_skip_1(conda_env, load_path, meta_file)
4471
@debug "meta version has changed" meta.version VERSION
4572
return false
4673
end
47-
if meta.load_path != load_path
74+
if !issameloadpath(meta.load_path, load_path)
4875
@debug "load path has changed" meta.load_path load_path
4976
return false
5077
end
51-
if meta.conda_env != conda_env
78+
if !issamefile(meta.conda_env, conda_env)
5279
@debug "conda env has changed" meta.conda_env conda_env
5380
return false
5481
end

0 commit comments

Comments
 (0)