Advertisement
sakuya-inu-izayoi

touhoufm installer

Oct 19th, 2015
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;NSIS Modern User Interface
  2. ;Start Menu Folder Selection Example Script
  3. ;Written by Joost Verburg
  4.  
  5. ;--------------------------------
  6. ;Include Modern UI
  7.  
  8.   !include "MUI2.nsh"
  9.  
  10.   !define MUI_ICON "TouHouFM/touhou.ico"
  11.  
  12. ;--------------------------------
  13. ;General
  14.  
  15.   ;Name and file
  16.   Name "TouHouFM Desktop Player"
  17.   OutFile "TouHouFM.exe"
  18.  
  19.   ;Default installation folder
  20.   InstallDir "$PROGRAMFILES\TouHou.FM"
  21.  
  22.   ;Get installation folder from registry if available
  23.   InstallDirRegKey HKCU "Software\TouHou.FM" ""
  24.  
  25.   ;Request application privileges for Windows Vista
  26.   RequestExecutionLevel admin
  27.  
  28. ;--------------------------------
  29. ;Variables
  30.  
  31.   Var StartMenuFolder
  32.  
  33. ;--------------------------------
  34. ;Interface Settings
  35.  
  36.   !define MUI_ABORTWARNING
  37.  
  38. ;--------------------------------
  39. ;Pages
  40.  
  41.   !insertmacro MUI_PAGE_COMPONENTS
  42.   !insertmacro MUI_PAGE_DIRECTORY
  43.  
  44.   ;Start Menu Folder Page Configuration
  45.   !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
  46.   !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\TouHou.FM"
  47.   !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
  48.  
  49.   !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
  50.  
  51.   !insertmacro MUI_PAGE_INSTFILES
  52.  
  53.   !insertmacro MUI_UNPAGE_CONFIRM
  54.   !insertmacro MUI_UNPAGE_INSTFILES
  55.  
  56. ;--------------------------------
  57. ;Languages
  58.  
  59.   !insertmacro MUI_LANGUAGE "English"
  60.  
  61. ;--------------------------------
  62. ;Installer Sections
  63.  
  64. Section "TouHouFM" SecPlayer
  65.   SectionIn RO
  66.  
  67.   SetOutPath "$INSTDIR"
  68.  
  69.   File /r /x skins TouHouFM\*
  70.   ;ADD YOUR OWN FILES HERE...
  71.  
  72.   ;Store installation folder
  73.   WriteRegStr HKCU "Software\TouHou.FM" "" $INSTDIR
  74.  
  75.   ;Create uninstaller
  76.   WriteUninstaller "$INSTDIR\Uninstall.exe"
  77.  
  78.   !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
  79.    
  80.     ;Create shortcuts
  81.     CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
  82.     CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
  83.     CreateShortcut "$SMPROGRAMS\$StartMenuFolder\TouHouFM.lnk" "$INSTDIR\TouHouFM.exe" "$INSTDIR\touhou.ico"
  84.  
  85.   !insertmacro MUI_STARTMENU_WRITE_END
  86.  
  87. SectionEnd
  88.  
  89. Section "Skins" SecSkins
  90.   SetOutPath "$INSTDIR\skins"
  91.  
  92.   File /r "TouHouFM\skins\*.*"
  93.  
  94. SectionEnd
  95.  
  96. ;--------------------------------
  97. ;Descriptions
  98.  
  99.   ;Language strings
  100.   LangString DESC_SecPlayer ${LANG_ENGLISH} "The player itself."
  101.   LangString DESC_SecSkins ${LANG_ENGLISH} "Extra skins."
  102.  
  103.   ;Assign language strings to sections
  104.   !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  105.     !insertmacro MUI_DESCRIPTION_TEXT ${SecPlayer} $(DESC_SecPlayer)
  106.     !insertmacro MUI_DESCRIPTION_TEXT ${SecSkins} $(DESC_SecSkins)
  107.   !insertmacro MUI_FUNCTION_DESCRIPTION_END
  108.  
  109. ;--------------------------------
  110. ;Uninstaller Section
  111.  
  112. Section "Uninstall"
  113.  
  114.   ;ADD YOUR OWN FILES HERE...
  115.  
  116.   Delete "$INSTDIR\platforms\*"
  117.   RMDir "$INSTDIR\platforms"
  118.   Delete "$INSTDIR\audio\*"
  119.   RMDir "$INSTDIR\audio"
  120.   Delete "$INSTDIR\mediaservice\*"
  121.   RMDir "$INSTDIR\mediaservice"
  122.   Delete "$INSTDIR\skins\*"
  123.   RMDir "$INSTDIR\skins"
  124.   Delete "$INSTDIR\*"
  125.  
  126.   RMDir "$INSTDIR"
  127.  
  128.   !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
  129.    
  130.   Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
  131.   Delete "$SMPROGRAMS\$StartMenuFolder\TouHouFM.lnk"
  132.   RMDir "$SMPROGRAMS\$StartMenuFolder"
  133.  
  134.   DeleteRegKey /ifempty HKCU "Software\Modern UI Test"
  135.  
  136. SectionEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement