If I call downloadPackage' to a destination directory I haven't created yet, I get a weird error:
my-exe: /Users/bchinn/.cache/my-exe/package-index/hackage.haskell.org/01-index.tar: withFile: does not exist (No such file or directory)
This is weird because that filepath does exist.
Digging deeper, I found the issue occurs in the renameFile call. Because I didn't create the destination directory yet, renameFile errors with:
renameFile:renamePath:rename '/Users/bchinn/.cache/my-exe/package-index/hackage.haskell.org/Cabal-syntax-3.10.2.0.tar75518-0.gz' to '/Users/bchinn/.cache/my-exe/packages/Cabal-syntax-3.10.2.0': does not exist (No such file or directory)
But this error gets swallowed; presumably there's some clean up step that looks for 01-index.tar and errors before showing the actual error.
A few action items:
Document that downloadPackage requires directory to exist (or create the directory automatically if it doesn't)
Investigate why withFile complains about the file not existing when... it does?
Check if the destination exists beforehand and show a better error message (contingent on how 1 and 2 get resolved)
If I call
downloadPackage'
to a destination directory I haven't created yet, I get a weird error:This is weird because that filepath does exist.
Digging deeper, I found the issue occurs in the
renameFile
call. Because I didn't create the destination directory yet,renameFile
errors with:But this error gets swallowed; presumably there's some clean up step that looks for
01-index.tar
and errors before showing the actual error.A few action items:
downloadPackage
requires directory to exist (or create the directory automatically if it doesn't)withFile
complains about the file not existing when... it does?