Skip to content

Commit 0ccd118

Browse files
committed
Merge preference_name and path_name
I decided that having `_path` on the end of preferences is a smart idea, so that we can do other things like `_dlflags` or something in the future.
1 parent da1c30a commit 0ccd118

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

src/products/executable_generators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ end
5959

6060
macro init_executable_product(product_name, product_path)
6161
preference_name = string(product_name, "_path")
62-
path_name = Symbol(string(product_name, "_path"))
62+
path_name = Symbol(preference_name)
6363
return esc(quote
6464
# Locate the executable on-disk, store into $(path_name)
6565
global $(path_name) = $(emit_preference_path_load(preference_name, product_path))

src/products/file_generators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ end
1313

1414
macro init_file_product(product_name, product_path)
1515
preference_name = string(product_name, "_path")
16-
path_name = Symbol(string(product_name, "_path"))
16+
path_name = Symbol(preference_name)
1717
return esc(quote
1818
# FileProducts are very simple, and we maintain the `_path` suffix version for consistency
1919
global $(path_name) = $(emit_preference_path_load(preference_name, product_path))

src/products/library_generators.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ end
4040

4141
macro init_library_product(product_name, product_path, dlopen_flags)
4242
handle_name = Symbol(string(product_name, "_handle"))
43-
path_name = Symbol(string(product_name, "_path"))
4443
preference_name = string(product_name, "_path")
44+
path_name = Symbol(preference_name)
4545
return excat(quote
4646
global $(path_name) = $(emit_preference_path_load(preference_name, product_path))
4747
# Manually `dlopen()` this right now so that future invocations

src/wrapper_generators.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,13 @@ with the given default value. On Julia 1.5-, simply emits the default value.
5959
"""
6060
function emit_preference_path_load(pref_name, product_path)
6161
# Can't use `Preferences.jl` on older Julias, just always use the default value in that case
62-
if VERSION < v"1.6.0-DEV"
62+
@static if VERSION < v"1.6.0-DEV"
6363
return quote
6464
joinpath(artifact_dir, $(product_path))
6565
end
66-
end
67-
return quote
68-
@load_preference($(pref_name), joinpath(artifact_dir, $(product_path)))
66+
else
67+
return quote
68+
@load_preference($(pref_name), joinpath(artifact_dir, $(product_path)))
69+
end
6970
end
7071
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module TestJLL end
1515
# Prepare some overrides for various products
1616
@static if VERSION >= v"1.6.0-DEV"
1717
set_preferences!(joinpath(dir, "LocalPreferences.toml"), "Vulkan_Headers_jll", "vulkan_hpp_path" => "foo")
18-
set_preferences!(joinpath(dir, "LocalPreferences.toml"), "HelloWorldC_jll", "goodbye_world" => "goodbye")
18+
set_preferences!(joinpath(dir, "LocalPreferences.toml"), "HelloWorldC_jll", "goodbye_world_path" => "goodbye")
1919
set_preferences!(joinpath(dir, "LocalPreferences.toml"), "OpenLibm_jll", "libnonexisting_path" => "libreallynonexisting")
2020
end
2121

0 commit comments

Comments
 (0)