Skip to content

Commit

Permalink
Add versioned GHCi to right-click menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
23Skidoo committed Dec 11, 2011
1 parent 61884ee commit 801d80c
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions Nsisfile.nsi
Expand Up @@ -116,7 +116,7 @@ SectionEnd


SectionGroup "Update system settings" SecGr SectionGroup "Update system settings" SecGr


Section "Associate .hs/.lhs files with GHCi" SecAssoc Section "Associate with .hs/.lhs files" SecAssoc


SectionIn 1 SectionIn 1


Expand All @@ -132,6 +132,17 @@ Section "Associate .hs/.lhs files with GHCi" SecAssoc


SectionEnd SectionEnd


Section "Add versioned GHCi to right-click menu" SecGHCiVersioned

SectionIn 1

WriteRegStr HKCR "ghc_haskell\shell\Open with GHCi ${GHC_VERSION}" "" ""
WriteRegStr HKCR "ghc_haskell\shell\Open with GHCi ${GHC_VERSION}\command" "" '"$INSTDIR\bin\ghci.exe" "%1"'

;Remember that we added versioned GHCi
WriteRegDWORD HKLM "${PRODUCT_DIR_REG_KEY}" VersionedGHCi 0x1
SectionEnd

Section "Update the PATH environment variable" SecPath Section "Update the PATH environment variable" SecPath


SectionIn 1 SectionIn 1
Expand All @@ -144,7 +155,6 @@ Section "Update the PATH environment variable" SecPath
${EnvVarUpdate} $0 "PATH" "P" "HKCU" "$APPDATA\cabal\bin" ${EnvVarUpdate} $0 "PATH" "P" "HKCU" "$APPDATA\cabal\bin"
SetShellVarContext all SetShellVarContext all



SectionEnd SectionEnd


Section "Store GHC's location in registry" Section "Store GHC's location in registry"
Expand Down Expand Up @@ -241,12 +251,21 @@ Section "Uninstall"
RMDir "$SMPROGRAMS\$START_MENU_FOLDER\" RMDir "$SMPROGRAMS\$START_MENU_FOLDER\"


; Delete registry keys ; Delete registry keys
ReadRegDWORD $0 HKLM "${PRODUCT_DIR_REG_KEY}" VersionedGHCi

${If} $0 = 0x1
DeleteRegKey HKCR "ghc_haskell\shell\Open with GHCi ${GHC_VERSION}\command"
DeleteRegKey HKCR "ghc_haskell\shell\Open with GHCi ${GHC_VERSION}"
${EndIf}

ReadRegDWORD $0 HKLM "${PRODUCT_DIR_REG_KEY}" Assocs ReadRegDWORD $0 HKLM "${PRODUCT_DIR_REG_KEY}" Assocs


${If} $0 = 0x1 ${If} $0 = 0x1
DeleteRegKey HKCR ".hs" DeleteRegValue HKCR ".hs" ""
DeleteRegKey HKCR ".lhs" DeleteRegValue HKCR ".lhs" ""
DeleteRegKey HKCR "ghc_haskell" DeleteRegValue HKCR "ghc_haskell\shell\open\command" ""
DeleteRegKey HKCR "ghc_haskell\DefaultIcon"
DeleteRegKey /IfEmpty HKCR "ghc_haskell"
${EndIf} ${EndIf}


DeleteRegKey HKCU "Software\Haskell\GHC\ghc-${GHC_VERSION}" DeleteRegKey HKCU "Software\Haskell\GHC\ghc-${GHC_VERSION}"
Expand Down

0 comments on commit 801d80c

Please sign in to comment.