Skip to content

Commit c5d886e

Browse files
committed
Search upwards from at-script
1 parent d7193ec commit c5d886e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ difference between defining a `main` function and executing the code directly at
6868
* The `--compiled-modules` and `--pkgimages` flags can now be set to `existing`, which will
6969
cause Julia to consider loading existing cache files, but not to create new ones ([#50586]
7070
and [#52573]).
71-
* The `--project` argument now accepts `@script` to give a path to a directory with a Project.toml relative to the passed script file. E.g. `--project=@script` for the same directory or `--project=@script/foo` for the `foo` subdirectory. ([#50864] and [#53352])
71+
* The `--project` argument now accepts `@script` to give a path to a directory with a Project.toml relative to the passed script file. `--project=@script/foo` for the `foo` subdirectory. If no path is given after (i.e. `--project=@script`) then (like `--project=@`) the directory and its parents are searched for a Project.toml ([#50864] and [#53352])
7272

7373
Multi-threading changes
7474
-----------------------

base/initdefs.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,12 @@ function load_path_expand(env::AbstractString)::Union{String, Nothing}
283283
end
284284
dir = dirname(ARGS[1])
285285
end
286-
return abspath(replace(env, "@script" => dir))
286+
if env == "@script" # complete match, not startswith, so search upwards
287+
return current_project(dir)
288+
else
289+
# starts with, so assume rleative path is after
290+
return abspath(replace(env, "@script" => dir))
291+
end
287292
end
288293
env = replace(env, '#' => VERSION.major, count=1)
289294
env = replace(env, '#' => VERSION.minor, count=1)

0 commit comments

Comments
 (0)