-
Notifications
You must be signed in to change notification settings - Fork 11
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
Win32 support #130
Win32 support #130
Conversation
src/App/Commands/SyncToArchive.hs
Outdated
) | ||
<*> strOption | ||
( long "store-path" | ||
<> help "Path to cabal store" | ||
<> metavar "DIRECTORY" | ||
<> value (homeDirectory </> ".cabal" </> "store") | ||
<> value (dotCabalDirectory </> "store") |
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.
The store is not always in .cabal/store
. Specifically, on windows, it's often been seen as a good idea to relocate the store to the root of the C drive to help prevent and work around long path issues (as well as APPDATA generally not being the best default for that). The haskell setup github action does this by setting the store path to C:\sr
(a convention adapted previously by others, such as Stack).
This raises a few difficulties, because cabal doesn't have a sane way to query its configuration by calling the binary. The location of the store is given inside cabal's configuration file or the default. The default is .cabal/store
but the cabal directory itself can have its location modified by an environment variable. The gory details are here
Cabal, the library, contains functions that will do the heavy lifting for you, but it's also quite heavyweight. Looking for the configuration file, reading it, and then determining the store from there (falling back to the default location otherwise) seems like the safest course of action if you don't want to use the cabal library.
A hacky one might be to check for the existence of cabal's store in a few hardcoded locations (eg ~/.cabal/store
for linux and macos, and $env:AppData\cabal\store
and C:\sr
for windows.). Can't imagine the hacky solution being robust enough to be relied on, though.
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.
dotCabalDirectory
is actually missed named. It should actually just be cabalDirectory
.
The value will be $HOME/.cabal
on Posix and $APPDATA/cabal
on Windows.
For cases where it is neither of these, the CI system can pass it in as a command line argument using --store-path
.
bc7992f
to
8fe2d5e
Compare
I've verified this can sync to and from a local directory. I've not tested remote yet, but I don't see a reason why that shouldn't just work. If you like you can give this a spin and let me know if you encounter any issues. |
8fe2d5e
to
a9d65f4
Compare
a9d65f4
to
2dc7936
Compare
Confirmed that remote sync on Windows works. |
Add support for Windows. See #129