@@ -20,7 +20,6 @@ using PreallocationTools
2020using PrecompileTools
2121using Pkg
2222using DifferentiationInterface
23- import SciMLBase: successful_retcode
2423import YAML
2524using StructMapping
2625using Xfoil
@@ -202,9 +201,11 @@ const AeroData = Union{
202201 Tuple{Vector{Float64}, Vector{Float64}, Matrix{Float64}, Matrix{Float64}, Matrix{Float64}}
203202 }
204203
204+ const PACKAGE_ROOT = normpath (joinpath (@__DIR__ , " .." ))
205+
205206function menu ()
206207 # Load the examples menu using a portable path
207- ex = joinpath (dirname ( pathof ( @__MODULE__ )), " .. " , " examples" , " menu.jl" )
208+ ex = joinpath (PACKAGE_ROOT , " examples" , " menu.jl" )
208209 Base. include (Main, normpath (ex))
209210end
210211
@@ -219,13 +220,13 @@ function copy_examples()
219220 if ! isdir (PATH)
220221 mkdir (PATH)
221222 end
222- src_path = joinpath (dirname ( pathof ( @__MODULE__ )), " .. " , PATH)
223+ src_path = joinpath (PACKAGE_ROOT , PATH)
223224 copy_files (PATH, readdir (src_path))
224225end
225226
226227function install_examples (add_packages= true )
227228 copy_examples ()
228- pkg_root = joinpath ( dirname ( pathof ( @__MODULE__ )), " .. " )
229+ pkg_root = PACKAGE_ROOT
229230 src = joinpath (pkg_root, " data" )
230231 isdir (src) && cp (src, " data" ; force= true )
231232 if add_packages
@@ -241,7 +242,7 @@ function copy_files(relpath, files)
241242 if ! isdir (relpath)
242243 mkdir (relpath)
243244 end
244- src_path = joinpath (dirname ( pathof ( @__MODULE__ )), " .. " , relpath)
245+ src_path = joinpath (PACKAGE_ROOT , relpath)
245246 for file in files
246247 cp (joinpath (src_path, file), joinpath (relpath, file), force= true )
247248 chmod (joinpath (relpath, file), 0o774 )
@@ -254,7 +255,7 @@ function help(url)
254255 io = IOBuffer ()
255256 run (pipeline (` xdg-open $url ` , stderr = io))
256257 # ignore any error messages
257- out_data = String (take! (io))
258+ String (take! (io))
258259 else
259260 DefaultApplication. open (url)
260261 end
0 commit comments