Skip to content
  • Duncan Coutts's avatar
    Allow cabal-install to re-install itself on Windows · 1fc051e4
    Duncan Coutts authored
    This is a fairly heavyweight solution, but then it's quite
    a nasty problem. What we do is when we notice that we're
    about to install something in place of our own .exe file,
    we move our exe file out of the way (but in the same dir).
    Then after we've installed the new exe we call it and ask
    it to delete the old file (so we do not litter the bin dir
    with lots of old versions). That requires synchronising
    between the old and new programs and for the new program
    to understand a command to do the syncing and deleting of
    the old program. Lots of Win32 FFI imports. :-(
    On the plus side it seems to work and is transparent to
    the user and the rest of cabal-install. In particular the
    actual file-installation code (which is burried deep
    within Cabal) does not need to know about the special case
    of installing over our own exe file.
    1fc051e4