Skip to content

Commit

Permalink
Merge pull request #12 from staticfloat/sf/canonical_dirs
Browse files Browse the repository at this point in the history
Ensure that directories always end in `'/'` for `canonical_rpaths()`
  • Loading branch information
staticfloat authored Aug 14, 2018
2 parents 9f6944e + 158bb02 commit e887198
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ os:
- linux
- osx
julia:
- 0.7
- 1.0
- nightly
notifications:
email: false
Expand Down
5 changes: 5 additions & 0 deletions src/Abstract/DynamicLink.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ function canonical_rpaths(rpath::RPath)
paths[idx] = replace(paths[idx], "@loader_path" => origin)
paths[idx] = replace(paths[idx], "@executable_path" => origin)
paths[idx] = abspath(paths[idx])

# Make sure that if it's a directory, it _always_ has a "/" at the end.
if isdir(paths[idx]) && paths[idx][end] != '/'
paths[idx] = paths[idx] * "/"
end
end
return paths
end
Expand Down
2 changes: 1 addition & 1 deletion src/COFF/COFFDynamicLink.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ rpaths(crp::COFFRPath) = String[]

# COFF files don't have an RPath, but they _do_ always search the $ORIGIN
function canonical_rpaths(crp::COFFRPath)
return [dirname(path(handle(crp)))]
return [abspath(dirname(path(handle(crp))) * "/")]
end
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function test_libfoo_and_fooifier(fooifier_path, libfoo_path)
# Ensure that `dir_path` is one of the RPath entries
rpath = RPath(oh_exe)
can_paths = canonical_rpaths(rpath)
@test abspath(dir_path) in can_paths
@test abspath(dir_path * "/") in can_paths

# Ensure that `fooifier` is going to try to load `libfoo`:
foo_libs = find_libraries(oh_exe)
Expand Down

0 comments on commit e887198

Please sign in to comment.