Skip to content

Commit

Permalink
Merge pull request #253 from julia-vscode/fe/paths
Browse files Browse the repository at this point in the history
Fix package paths when replacing placeholder.
  • Loading branch information
fredrikekre authored May 23, 2022
2 parents 80edf77 + 6ffe992 commit 076e611
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -508,17 +508,20 @@ function get_file_from_cloud(manifest, uuid, environment_path, depot_dir, cache_
return false
end

pkg_path = Base.locate_package(Base.PkgId(uuid, name))
if pkg_path === nothing || !isfile(pkg_path)
pkg_path = get_pkg_path(Base.PkgId(uuid, name), environment_path, depot_dir)
end
if pkg_path === nothing
@info "Successfully downloaded and saved $(name), but with placeholder paths"
return false
pkg_entry = Base.locate_package(Base.PkgId(uuid, name))
if pkg_entry !== nothing && isfile(pkg_entry)
pkg_src = dirname(pkg_entry)
else
pkg_root = get_pkg_path(Base.PkgId(uuid, name), environment_path, depot_dir)
if pkg_root === nothing
@info "Successfully downloaded and saved $(name), but with placeholder paths"
return false
end
pkg_src = joinpath(pkg_root, "src")
end

@debug "dirname" dirname(pkg_path)
modify_dirs(cache.val, f -> modify_dir(f, r"^PLACEHOLDER", joinpath(pkg_path, "src")))
@debug "Replacing PLACEHOLDER with:" pkg_src
modify_dirs(cache.val, f -> modify_dir(f, r"^PLACEHOLDER", pkg_src))
open(file, "w") do io
CacheStore.write(io, cache)
end
Expand Down

0 comments on commit 076e611

Please sign in to comment.