Skip to content

Commit

Permalink
Call expanduser on --project argument, fixes #28638 (#31932)
Browse files Browse the repository at this point in the history
  • Loading branch information
Moelf authored and fredrikekre committed Jun 4, 2019
1 parent c5d190e commit 66408f3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion base/initdefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ function init_load_path()
HOME_PROJECT[] =
project === nothing ? nothing :
project == "" ? nothing :
project == "@." ? current_project() : abspath(project)
project == "@." ? current_project() : abspath(expanduser(project))
append!(empty!(LOAD_PATH), paths)
end

Expand Down
5 changes: 0 additions & 5 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -628,11 +628,6 @@ static void jl_resolve_sysimg_location(JL_IMAGE_SEARCH rel)
jl_options.outputbc = abspath(jl_options.outputbc, 0);
if (jl_options.machine_file)
jl_options.machine_file = abspath(jl_options.machine_file, 0);
if (jl_options.project
&& strcmp(jl_options.project, "@.") != 0
&& strcmp(jl_options.project, "@") != 0
&& strcmp(jl_options.project, "") != 0)
jl_options.project = abspath(jl_options.project, 0);
if (jl_options.output_code_coverage)
jl_options.output_code_coverage = absformat(jl_options.output_code_coverage);

Expand Down
7 changes: 7 additions & 0 deletions test/cmdlineargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ let exename = `$(Base.julia_cmd()) --startup-file=no`
@test startswith(read(`$exename --help`, String), header)
end

# ~ expansion in --project and JULIA_PROJECT
if !Sys.iswindows()
expanded = abspath(expanduser("~/foo"))
@test occursin(expanded, readchomp(`$exename --project='~/foo' -E 'Base.active_project()'`))
@test occursin(expanded, readchomp(setenv(`$exename -E 'Base.active_project()'`, "JULIA_PROJECT"=>"~/foo")))
end

# --quiet, --banner
let t(q,b) = "Base.JLOptions().quiet == $q && Base.JLOptions().banner == $b"
@test success(`$exename -e $(t(0, -1))`)
Expand Down

0 comments on commit 66408f3

Please sign in to comment.