Skip to content

Commit 16afe39

Browse files
committed
better paths
1 parent 035bc4b commit 16afe39

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

src/build_sysimg.jl

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,7 @@ current processor. Include the user image file given by `userimg_path`, which sh
5353
directives such as `using MyPackage` to include that package in the new system image. New
5454
system image will not replace an older image unless `force` is set to true.
5555
"""
56-
function build_sysimg(sysimg_path, cpu_target = "native", userimg_path = nothing; debug=false)
57-
58-
# Canonicalize userimg_path before we enter the base_dir
59-
if userimg_path !== nothing
60-
userimg_path = abspath(userimg_path)
61-
end
56+
function build_sysimg(sysimg_path, cpu_target, userimg_path; debug = false)
6257
# Enter base and setup some useful paths
6358
base_dir = dirname(Base.find_source_file("sysimg.jl"))
6459
cd(base_dir) do
@@ -74,15 +69,13 @@ function build_sysimg(sysimg_path, cpu_target = "native", userimg_path = nothing
7469
end
7570

7671
# Copy in userimg.jl if it exists
77-
if userimg_path !== nothing
78-
if !isfile(userimg_path)
79-
error("$userimg_path is not found, ensure it is an absolute path.")
80-
end
81-
if isfile("userimg.jl")
82-
error("$base_dir/userimg.jl already exists, delete manually to continue.")
83-
end
84-
cp(userimg_path, "userimg.jl")
72+
if !isfile(userimg_path)
73+
error("$userimg_path is not found, ensure it is an absolute path.")
74+
end
75+
if isfile("userimg.jl")
76+
error("$base_dir/userimg.jl already exists, delete manually to continue.")
8577
end
78+
cp(userimg_path, "userimg.jl")
8679
try
8780
# Start by building inference.{ji,o}
8881
inference_path = joinpath(dirname(sysimg_path), "inference")
@@ -99,7 +92,7 @@ function build_sysimg(sysimg_path, cpu_target = "native", userimg_path = nothing
9992

10093
finally
10194
# Cleanup userimg.jl
102-
if userimg_path !== nothing && isfile("userimg.jl")
95+
if isfile("userimg.jl")
10396
rm("userimg.jl")
10497
end
10598
end

0 commit comments

Comments
 (0)