Skip to content

Commit 076e611

Browse files
authored
Merge pull request #253 from julia-vscode/fe/paths
Fix package paths when replacing placeholder.
2 parents 80edf77 + 6ffe992 commit 076e611

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/utils.jl

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -508,17 +508,20 @@ function get_file_from_cloud(manifest, uuid, environment_path, depot_dir, cache_
508508
return false
509509
end
510510

511-
pkg_path = Base.locate_package(Base.PkgId(uuid, name))
512-
if pkg_path === nothing || !isfile(pkg_path)
513-
pkg_path = get_pkg_path(Base.PkgId(uuid, name), environment_path, depot_dir)
514-
end
515-
if pkg_path === nothing
516-
@info "Successfully downloaded and saved $(name), but with placeholder paths"
517-
return false
511+
pkg_entry = Base.locate_package(Base.PkgId(uuid, name))
512+
if pkg_entry !== nothing && isfile(pkg_entry)
513+
pkg_src = dirname(pkg_entry)
514+
else
515+
pkg_root = get_pkg_path(Base.PkgId(uuid, name), environment_path, depot_dir)
516+
if pkg_root === nothing
517+
@info "Successfully downloaded and saved $(name), but with placeholder paths"
518+
return false
519+
end
520+
pkg_src = joinpath(pkg_root, "src")
518521
end
519522

520-
@debug "dirname" dirname(pkg_path)
521-
modify_dirs(cache.val, f -> modify_dir(f, r"^PLACEHOLDER", joinpath(pkg_path, "src")))
523+
@debug "Replacing PLACEHOLDER with:" pkg_src
524+
modify_dirs(cache.val, f -> modify_dir(f, r"^PLACEHOLDER", pkg_src))
522525
open(file, "w") do io
523526
CacheStore.write(io, cache)
524527
end

0 commit comments

Comments
 (0)