Skip to content
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

Allow configuring programs directory #2766

Merged
merged 7 commits into from
Nov 27, 2016

Conversation

ruuda
Copy link
Contributor

@ruuda ruuda commented Nov 8, 2016

This removes the hard-coded $LOCALAPPDATA\Programs\stack directory, and uses $STACK_ROOT\programs instead, unifying this path for all programs. This resolves #1644 and also my comment on #996.

@borsboom: You noted in #1644 that it would be good to make this configurable in stack.yaml. That would certainly be possible, but currently I do not see how that would be useful. I think it would introduce more knobs than necessary. Is there a compelling use case for downloading and extracting GHC to a different location than the snapshots?

  • Any changes that could be relevant to users have been recorded in the ChangeLog.md
  • The documentation has been updated, if necessary.

@mgsloan
Copy link
Contributor

mgsloan commented Nov 11, 2016

Thanks for working on this! The problem with this approach is that it means people will need to re-install their GHC versions, and will also leave the old GHC versions still there. This is why we'd prefer to make this an explicit option.

The reason to allow it to be specified in the config subset of stack.yaml is that then users can specify it in their config.yaml

@ruuda
Copy link
Contributor Author

ruuda commented Nov 14, 2016

I see. In that case, I think the proper thing to do (from a user perspective) would be to automatically move the data to the new location. But that would mean adding even more special cases for a while. Making this a configurable option with different defaults on Windows than on other platforms looks like an easier solution from an implementation point of view. What do you think?

@mgsloan
Copy link
Contributor

mgsloan commented Nov 15, 2016

Making this a configurable option with different defaults on Windows than on other platforms looks like an easier solution from an implementation point of view.

Sounds good to me!

Just use $STACK_ROOT/programs, like on other platforms. This enables the
directory to be configurable by setting $STACK_ROOT, and it removes the
hard-coded path. When downloading GHC, the archive is downloaded to this
directory as well before extraction. (This was the case anyway.) This is
perhaps less idiomatic, but $STACK_ROOT exists on Windows regardless, so
it seems better to keep everything in one place.

Fixes commercialhaskell#1644.
As far as I can git grep, Stack does not use TMP or TEMP or TEMPDIR any
more. As of commercialhaskell#996, stack setup does not download to the system temp
directory any more.
This is still a slightly different from the old behavior: the default
location in STACK_ROOT is used when the environment variable cannot be
read (which should never be the case anyway). The only difference is
that in that case the "programs" directory inside STACK_ROOT is not
capitalized.
This option overrides the localProgramsBase path. Ideally the base
path would be removed entirely, but it is also used for Docker-
related things.
@ruuda
Copy link
Contributor Author

ruuda commented Nov 26, 2016

I rebased this and changed it to keep the $LOCALAPPDATA default. There now is a local-programs-path, which defaults to $STACK_ROOT/programs except on Windows, where it defaults to $LOCALAPPDATA\Programs\stack. When getting $LOCALAPPDATA fails (I don’t think that should ever happen), it now defaults to $STACK_ROOT\programs on Windows too.

I have not tested this on Windows yet, I’ll try that tomorrow. I did test this on Linux.

@ruuda ruuda changed the title Do not special-case programs directory on Windows Allow configuring programs directory Nov 26, 2016
@mgsloan
Copy link
Contributor

mgsloan commented Nov 27, 2016

LGTM, thanks!

@ghost
Copy link

ghost commented Jul 19, 2019

I rebased this and changed it to keep the $LOCALAPPDATA default. There now is a local-programs-path, which defaults to $STACK_ROOT/programs except on Windows, where it defaults to $LOCALAPPDATA\Programs\stack. When getting $LOCALAPPDATA fails (I don’t think that should ever happen), it now defaults to $STACK_ROOT\programs on Windows too.

I have not tested this on Windows yet, I’ll try that tomorrow. I did test this on Linux.

This pretty much seems to work on windows!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ghc-paths and other installation directories are hard-coded on Windows
2 participants