-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update install location & add systemwide option #12
Conversation
Codecov Report
@@ Coverage Diff @@
## main #12 +/- ##
==========================================
- Coverage 84.37% 81.64% -2.73%
==========================================
Files 1 1
Lines 128 158 +30
==========================================
+ Hits 108 129 +21
- Misses 20 29 +9
Continue to review full report at Codecov.
|
This PR was complicated by the fact that
|
The issue was passing an invalid |
src/UpdateJulia.jl
Outdated
function default_install_location(systemwide, v) | ||
default = if systemwide | ||
@os "\\Program Files" "/Applications" "/opt" | ||
else | ||
(joinpath(homedir(), (@os "AppData\\Local\\Programs" "Applications" ".local"))) | ||
end | ||
current = dirname(dirname( | ||
@static Sys.isapple() ? dirname(dirname(dirname(Base.Sys.BINDIR))) : Base.Sys.BINDIR)) | ||
|
||
if current == default || (@static Sys.isunix() && (@static !Sys.isapple() && startswith(current, "/opt/julia"))) | ||
current | ||
else | ||
println("julia-$VERSION is currently installed in $current. Install julia-$v in $default instead? Y/n") | ||
response = readline(stdin) | ||
if isempty(response) || uppercase(first(response)) == 'Y' | ||
default | ||
elseif uppercase(first(response)) == 'N' | ||
current | ||
else | ||
error("Unknown input: $response. Expected 'y' or 'n'.") | ||
end | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed in #7
set_default = (@static Sys.iswindows() ? false : v==latest()), | ||
systemwide = !startswith(Base.Sys.BINDIR, homedir()), | ||
install_location = default_install_location(systemwide, v), | ||
bin = (@static Sys.iswindows() ? nothing : (systemwide ? "/usr/local/bin" : joinpath(homedir(), ".local/bin"))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed in #7
Need to document this behavior! |
fixes #7