ui_laser_setup.nsh 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015
  1. 
  2. !include "StrFunc.nsh"
  3. !include "WordFunc.nsh"
  4. ${StrRep}
  5. ${StrStr}
  6. !include "LogicLib.nsh"
  7. !include "nsDialogs.nsh"
  8. !include "common.nsh"
  9. !include "x64.nsh"
  10. !include "MUI.nsh"
  11. !include "WinVer.nsh"
  12. !include "commonfunc.nsh"
  13. !insertmacro MUI_LANGUAGE "SimpChinese"
  14. VIProductVersion "${PRODUCT_VERSION}"
  15. VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}"
  16. VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
  17. VIAddVersionKey "CompanyName" "${PRODUCT_PUBLISHER}"
  18. VIAddVersionKey "FileVersion" "${PRODUCT_VERSION}"
  19. VIAddVersionKey "InternalName" "${EXE_NAME}"
  20. VIAddVersionKey "FileDescription" "${PRODUCT_NAME}"
  21. VIAddVersionKey "LegalCopyright" "${PRODUCT_LEGAL}"
  22. !define INSTALL_PAGE_CONFIG 0
  23. ;!define INSTALL_PAGE_LICENSE 1
  24. !define INSTALL_PAGE_PROCESSING 1
  25. !define INSTALL_PAGE_FINISH 2
  26. !define INSTALL_PAGE_UNISTCONFIG 3
  27. !define INSTALL_PAGE_UNISTPROCESSING 4
  28. !define INSTALL_PAGE_UNISTFINISH 5
  29. Page custom DUIPage
  30. UninstPage custom un.DUIPage
  31. Var hInstallDlg
  32. Var hInstallSubDlg
  33. Var sCmdFlag
  34. Var sCmdSetupPath
  35. Var sSetupPath
  36. Var sReserveData
  37. Var InstallState
  38. Var UnInstallValue
  39. Var basedir
  40. Var datadir
  41. Var logError
  42. Var buildModelPath
  43. Var profilePath
  44. Var buildCallPath
  45. Var dbpath
  46. Var logpath
  47. Var binPath
  48. Var javaPath
  49. Var temp11
  50. Var temp12
  51. Var OLD_VER
  52. Var step
  53. ;在安装程序运行前的回调函数前实现
  54. Function .onInit
  55. System::Call 'kernel32::CreateMutexA(i 0, i 0, t"Winsnap_installer") i .r1 ?e'
  56. Pop $R0
  57. StrCmp $R0 0 +3
  58. MessageBox MB_OK|MB_USERICON '有一个安装向导已经运行,请勿重复打开'
  59. Abort
  60. ${IfNot} ${AtLeastWin10}
  61. MessageBox MB_OK|MB_USERICON '本程序只能安装在windows-10(64位)系统上'
  62. Abort
  63. ${EndIf}
  64. ReadRegStr $OLD_VER HKLM "SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_PATHNAME}" "DisplayVersion"
  65. ${IF} $OLD_VER != ""
  66. ${VersionCompare} $OLD_VER ${PRODUCT_VERSION} $R0
  67. ${If} $R0 == "0"
  68. MessageBox MB_OK|MB_USERICON '${PRODUCT_PATHNAME},版本 $OLD_VER 已安装在计算机中。如需重新安装,请卸载已有的安装'
  69. Quit
  70. ${EndIf}
  71. ${If} $R0 == "1"
  72. MessageBox MB_OK|MB_USERICON '${PRODUCT_PATHNAME},版本 $OLD_VER 已安装在计算机中。如需重新安装,请卸载已有的安装'
  73. ;MessageBox MB_OK|MB_USERICON '${PRODUCT_PATHNAME},您安装的版本是 ${PRODUCT_VERSION} 小于版本 $OLD_VER '
  74. Quit
  75. ${EndIf}
  76. ${If} $R0 == "2"
  77. MessageBox MB_OK|MB_USERICON '${PRODUCT_PATHNAME},版本 $OLD_VER 已安装在计算机中。如需重新安装,请卸载已有的安装'
  78. ;MessageBox MB_OK|MB_USERICON '${PRODUCT_PATHNAME},您安装的版本是 ${PRODUCT_VERSION} 大于版本 $OLD_VER '
  79. Quit
  80. ${EndIf}
  81. ${EndIf}
  82. FunctionEnd
  83. Function un.onInit
  84. System::Call 'kernel32::CreateMutexA(i 0, i 0, t"Winsnap_installer") i .r1 ?e'
  85. Pop $R0
  86. StrCmp $R0 0 +3
  87. MessageBox MB_OK|MB_USERICON '有一个卸载向导已经运行,请勿重复打开'
  88. Abort
  89. FunctionEnd
  90. Function DUIPage
  91. StrCpy $InstallState "0"
  92. InitPluginsDir
  93. SetOutPath "$PLUGINSDIR"
  94. File "${INSTALL_LICENCE_FILENAME}"
  95. File "${INSTALL_RES_PATH}"
  96. File /oname=logo.ico "${INSTALL_ICO}" #
  97. nsNiuniuSkin::InitSkinPage "$PLUGINSDIR\" "${INSTALL_LICENCE_FILENAME}"
  98. Pop $hInstallDlg
  99. Call GenerateSetupAddress
  100. nsNiuniuSkin::SetControlAttribute $hInstallDlg "editDir" "text" "$INSTDIR\"
  101. Call OnRichEditTextChange
  102. nsNiuniuSkin::SetWindowTile $hInstallDlg "${PRODUCT_NAME}安装程序"
  103. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_CONFIG}
  104. nsNiuniuSkin::SetControlAttribute $hInstallDlg "licensename" "text" "《四维深时本地版用户许可协议》"
  105. Call BindUIControls
  106. nsNiuniuSkin::ShowPage 0
  107. FunctionEnd
  108. Function un.DUIPage
  109. StrCpy $InstallState "0"
  110. InitPluginsDir
  111. SetOutPath "$PLUGINSDIR"
  112. File "${INSTALL_RES_PATH}"
  113. File /oname=logo.ico "${UNINSTALL_ICO}"
  114. nsNiuniuSkin::InitSkinPage "$PLUGINSDIR\" ""
  115. Pop $hInstallDlg
  116. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTCONFIG}
  117. nsNiuniuSkin::SetWindowTile $hInstallDlg "${PRODUCT_NAME}卸载程序"
  118. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 390s
  119. Call un.BindUnInstUIControls
  120. nsNiuniuSkin::SetControlAttribute $hInstallDlg "chkAutoRun" "selected" "true"
  121. nsNiuniuSkin::ShowPage 0
  122. FunctionEnd
  123. Function un.BindUnInstUIControls
  124. GetFunctionAddress $0 un.ExitDUISetup
  125. nsNiuniuSkin::BindCallBack $hInstallDlg "btnUninstalled" $0
  126. GetFunctionAddress $0 un.onUninstall
  127. nsNiuniuSkin::BindCallBack $hInstallDlg "btnUnInstall" $0
  128. GetFunctionAddress $0 un.ExitDUISetup
  129. nsNiuniuSkin::BindCallBack $hInstallDlg "btnClose" $0
  130. GetFunctionAddress $0 un.OnBtnMin
  131. nsNiuniuSkin::BindCallBack $hInstallDlg "btnFinishedMin" $0
  132. GetFunctionAddress $0 un.BtnDirPre
  133. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirPre" $0
  134. FunctionEnd
  135. Function BindUIControls
  136. GetFunctionAddress $0 OnExitDUISetup
  137. nsNiuniuSkin::BindCallBack $hInstallDlg "btnLicenseClose" $0
  138. GetFunctionAddress $0 OnBtnMin
  139. nsNiuniuSkin::BindCallBack $hInstallDlg "btnLicenseMin" $0
  140. GetFunctionAddress $0 OnBtnLicenseClick
  141. nsNiuniuSkin::BindCallBack $hInstallDlg "btnAgreement" $0
  142. GetFunctionAddress $0 OnExitDUISetup
  143. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirClose" $0
  144. GetFunctionAddress $0 OnExitDUISetup
  145. nsNiuniuSkin::BindCallBack $hInstallDlg "btnLicenseCancel" $0
  146. GetFunctionAddress $0 OnBtnMin
  147. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirMin" $0
  148. GetFunctionAddress $0 OnBtnSelectDir
  149. nsNiuniuSkin::BindCallBack $hInstallDlg "btnSelectDir" $0
  150. GetFunctionAddress $0 OnBtnDirPre
  151. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirPre" $0
  152. GetFunctionAddress $0 OnBtnShowConfig
  153. nsNiuniuSkin::BindCallBack $hInstallDlg "btnAgree" $0
  154. GetFunctionAddress $0 OnBtnCancel
  155. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDirCancel" $0
  156. GetFunctionAddress $0 OnBtnInstall
  157. nsNiuniuSkin::BindCallBack $hInstallDlg "btnInstall" $0
  158. GetFunctionAddress $0 OnExitDUISetup
  159. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDetailClose" $0
  160. GetFunctionAddress $0 OnBtnMin
  161. nsNiuniuSkin::BindCallBack $hInstallDlg "btnDetailMin" $0
  162. GetFunctionAddress $0 OnFinished
  163. nsNiuniuSkin::BindCallBack $hInstallDlg "btnRun" $0
  164. GetFunctionAddress $0 OnBtnMin
  165. nsNiuniuSkin::BindCallBack $hInstallDlg "btnFinishedMin" $0
  166. GetFunctionAddress $0 OnExitDUISetup
  167. nsNiuniuSkin::BindCallBack $hInstallDlg "btnClose" $0
  168. GetFunctionAddress $0 OnCheckLicenseClick
  169. nsNiuniuSkin::BindCallBack $hInstallDlg "chkAgree" $0
  170. GetFunctionAddress $0 OnBtnShowMore
  171. nsNiuniuSkin::BindCallBack $hInstallDlg "btnShowMore" $0
  172. GetFunctionAddress $0 OnBtnHideMore
  173. nsNiuniuSkin::BindCallBack $hInstallDlg "btnHideMore" $0
  174. GetFunctionAddress $0 OnSysCommandCloseEvent
  175. nsNiuniuSkin::BindCallBack $hInstallDlg "syscommandclose" $0
  176. GetFunctionAddress $0 OnRichEditTextChange
  177. nsNiuniuSkin::BindCallBack $hInstallDlg "editDir" $0
  178. FunctionEnd
  179. Function OnRichEditTextChange
  180. nsNiuniuSkin::GetControlAttribute $hInstallDlg "editDir" "text"
  181. Pop $0
  182. StrCpy $INSTDIR "$0"
  183. Call onVerifyInstDir
  184. Pop $0
  185. ${If} $0 == 1
  186. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "不能包含中文路径"
  187. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
  188. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  189. goto TextChangeAbort
  190. ${EndIf}
  191. ${If} $0 == 2
  192. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "路径不能为空"
  193. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
  194. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  195. goto TextChangeAbort
  196. ${EndIf}
  197. Call IsSetupPathIlleagal
  198. ${If} $R5 == "0"
  199. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "路径错误"
  200. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#ffff0000"
  201. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  202. goto TextChangeAbort
  203. ${EndIf}
  204. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "textcolor" "#FF999999"
  205. ${If} $R0 > 1024
  206. IntOp $R1 $R0 % 1024
  207. IntOp $R0 $R0 / 1024;
  208. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "剩余空间:$R0.$R1GB"
  209. ${Else}
  210. nsNiuniuSkin::SetControlAttribute $hInstallDlg "local_space" "text" "剩余空间:$R0.$R1MB"
  211. ${endif}
  212. nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkAgree" "selected"
  213. Pop $0
  214. ${If} $0 == "1"
  215. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "true"
  216. ${Else}
  217. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  218. ${EndIf}
  219. TextChangeAbort:
  220. FunctionEnd
  221. Function OnCheckLicenseClick
  222. nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkAgree" "selected"
  223. Pop $0
  224. ${If} $0 == "0"
  225. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "true"
  226. ${Else}
  227. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnInstall" "enabled" "false"
  228. ${EndIf}
  229. FunctionEnd
  230. Function OnBtnLicenseClick
  231. ;nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_LICENSE}
  232. nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "visible" "true"
  233. nsNiuniuSkin::GetControlAttribute $hInstallDlg "moreconfiginfo" "visible"
  234. Pop $0
  235. ${If} $0 = 0
  236. ;pos="10,35,560,405"
  237. nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "pos" "5,35,475,385"
  238. nsNiuniuSkin::SetControlAttribute $hInstallDlg "editLicense" "height" "270"
  239. ${Else}
  240. nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "pos" "5,35,475,495"
  241. nsNiuniuSkin::SetControlAttribute $hInstallDlg "editLicense" "height" "375"
  242. ${EndIf}
  243. FunctionEnd
  244. Section "silentInstallSec" SEC01
  245. #MessageBox MB_OK|MB_ICONINFORMATION "Test silent install. you can add your silent install code here."
  246. SectionEnd
  247. Function ShowMsgBox
  248. nsNiuniuSkin::InitSkinSubPage "msgBox.xml" "btnOK" "btnCancel,btnClose"
  249. Pop $hInstallSubDlg
  250. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblTitle" "text" "提示"
  251. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblMsg" "text" "$R8"
  252. ${If} "$R7" == "1"
  253. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "hlCancel" "visible" "true"
  254. ${EndIf}
  255. nsNiuniuSkin::ShowSkinSubPage 0
  256. FunctionEnd
  257. Function OnBtnInstall
  258. nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkAgree" "selected"
  259. Pop $0
  260. StrCpy $0 "1"
  261. StrCmp $0 "0" InstallAbort 0
  262. nsProcess::_FindProcess "${EXE_NAME_EXT}"
  263. Pop $R0
  264. ${If} $R0 == 0
  265. StrCpy $R8 "${PRODUCT_NAME} 正在运行,请退出后重试!"
  266. StrCpy $R7 "0"
  267. Call ShowMsgBox
  268. goto InstallAbort
  269. ${EndIf}
  270. nsNiuniuSkin::GetControlAttribute $hInstallDlg "editDir" "text"
  271. Pop $0
  272. StrCmp $0 "" InstallAbort 0
  273. Call AdjustInstallPath
  274. StrCpy $sSetupPath "$INSTDIR"
  275. Call IsSetupPathIlleagal
  276. ${If} $R5 == "0"
  277. StrCpy $R8 "路径错误,请使用正确的路径安装!"
  278. StrCpy $R7 "0"
  279. Call ShowMsgBox
  280. goto InstallAbort
  281. ${EndIf}
  282. ${If} $R5 == "-1"
  283. StrCpy $R8 "目标磁盘空间不足,请使用其他的磁盘安装!"
  284. StrCpy $R7 "0"
  285. Call ShowMsgBox
  286. goto InstallAbort
  287. ${EndIf}
  288. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 390
  289. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "false"
  290. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_PROCESSING}
  291. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "min" "0"
  292. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "max" "100"
  293. #Call BakFiles
  294. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" "正在安装"
  295. GetFunctionAddress $0 ExtractFunc
  296. BgWorker::CallAndWait
  297. nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkShotcut" "selected"
  298. #Pop $R0
  299. # ${If} $R0 == "1"
  300. # SetShellVarContext all
  301. # CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${EXE_NAME}"
  302. # SetShellVarContext current
  303. # ${EndIf}
  304. SetShellVarContext all
  305. CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${EXE_NAME}"
  306. SetShellVarContext current
  307. Call CreateAppShortcut
  308. Call CreateUninstall
  309. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "true"
  310. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" "正在初始化..."
  311. GetFunctionAddress $0 OnEnvInstall
  312. BgWorker::CallAndWait
  313. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" "正在初始化服务..."
  314. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" ""
  315. GetFunctionAddress $0 installService
  316. BgWorker::CallAndWait
  317. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_tip" "text" "初始化完成"
  318. StrCpy $InstallState "1"
  319. #Call OnFinished
  320. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_FINISH}
  321. InstallAbort:
  322. FunctionEnd
  323. Function ExtractCallback
  324. Pop $1
  325. Pop $2
  326. System::Int64Op $1 * 100
  327. Pop $3
  328. System::Int64Op $3 / $2
  329. Pop $0
  330. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "value" "$0"
  331. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" "$0%"
  332. ${If} $1 == $2
  333. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrProgress" "value" "100"
  334. nsNiuniuSkin::SetControlAttribute $hInstallDlg "progress_pos" "text" "100%"
  335. ${EndIf}
  336. FunctionEnd
  337. Function OnSysCommandCloseEvent
  338. Call OnExitDUISetup
  339. FunctionEnd
  340. Function OnExitDUISetup
  341. ${If} $InstallState == "0"
  342. StrCpy $R8 "确定要停止安装吗?"
  343. StrCpy $R7 "1"
  344. Call ShowMsgBox
  345. pop $0
  346. ${If} $0 == 0
  347. goto endfun
  348. ${EndIf}
  349. ${EndIf}
  350. nsNiuniuSkin::ExitDUISetup
  351. endfun:
  352. FunctionEnd
  353. Function OnBtnMin
  354. SendMessage $hInstallDlg ${WM_SYSCOMMAND} 0xF020 0
  355. FunctionEnd
  356. Function OnBtnCancel
  357. nsNiuniuSkin::ExitDUISetup
  358. FunctionEnd
  359. Function OnEnvInstall
  360. EnVar::SetHKLM
  361. EnVar::AddValue FDMGEA_HOME "$INSTDIR"
  362. ;EnVar::SetHKLM
  363. ;EnVar::AddValue JAVA_HOME "$INSTDIR\jdk1.8"
  364. EnVar::SetHKLM
  365. EnVar::AddValue MYSQL_HOME "$INSTDIR\mysql"
  366. EnVar::SetHKLM
  367. EnVar::AddValue REDIS_HOME "$INSTDIR\redis"
  368. EnVar::SetHKLM
  369. EnVar::AddValue 4DKK_HOME "$INSTDIR\CGAII"
  370. EnVar::SetHKLM
  371. EnVar::AddValue MONGODB_HOME "$INSTDIR\mongodb"
  372. ;EnVar::SetHKLM
  373. ;EnVar::AddValue CLASS_PATH ".;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar"
  374. EnVar::SetHKLM
  375. ;EnVar::AddValue "Path" "$INSTDIR\jdk1.8\bin;$INSTDIR\mysql\bin;$INSTDIR\mongodb\bin;$INSTDIR\redis;$INSTDIR\CGAII;$INSTDIR\CGAII\lib;"
  376. EnVar::AddValue "Path" "$INSTDIR\mysql\bin;$INSTDIR\mongodb\bin;$INSTDIR\redis;$INSTDIR\CGAII;$INSTDIR\CGAII\lib;"
  377. SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
  378. ;nsExec::ExecToStack '"$INSTDIR\tools\env_install.bat" $INSTDIR '
  379. FunctionEnd
  380. Function un.OnEnvDownInstall
  381. EnVar::SetHKLM
  382. EnVar::Delete "FDMGEA_HOME" "$INSTDIR"
  383. ;EnVar::Delete "JAVA_HOME" "$INSTDIR\jdk1.8"
  384. EnVar::Delete "MYSQL_HOME" "$INSTDIR\mysql"
  385. EnVar::Delete "REDIS_HOME" "$INSTDIR\redis"
  386. EnVar::Delete "4DKK_HOME" "$INSTDIR\CGAII"
  387. EnVar::Delete "MONGODB_HOME" "$INSTDIR\mongodb"
  388. ;EnVar::Delete "CLASS_PATH" "%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar"
  389. ;EnVar::DeleteValue "PATH" "%JAVA_HOME%\bin"
  390. EnVar::DeleteValue "PATH" "$INSTDIR\mysql\bin"
  391. EnVar::DeleteValue "PATH" "$INSTDIR\mongodb\bin"
  392. EnVar::DeleteValue "PATH" "$INSTDIR\redis"
  393. EnVar::DeleteValue "PATH" "$INSTDIR\CGAII"
  394. EnVar::DeleteValue "PATH" "$INSTDIR\CGAII\lib"
  395. ;nsExec::ExecToStack '"$INSTDIR\tools\uninstall.bat" $INSTDIR '
  396. FunctionEnd
  397. Function un.installService
  398. ${If} $sReserveData == 1
  399. ; CreateDirectory $INSTDIR\USER_DATA\static
  400. ; CreateDirectory $INSTDIR\USER_DATA\pro
  401. ;CopyFiles /SILENT $INSTDIR\4DKK_PROGRAM_STATIC\*.* $INSTDIR\USER_DATA\static
  402. ;CopyFiles /SILENT $INSTDIR\4DKK_PROGRAM_DATA\*.* $INSTDIR\USER_DATA\pro
  403. ${EndIf}
  404. nsExec::ExecToStack '"$INSTDIR\tools\unservice.bat" $INSTDIR '
  405. SimpleSC::ExistsService "lasermongodb"
  406. Pop $0
  407. ${If} $0 == 0
  408. SimpleSC::StopService "lasermongodb" 0 30
  409. SimpleSC::RemoveService "lasermongodb"
  410. ${EndIf}
  411. SimpleSC::ExistsService "lasermysql"
  412. Pop $0
  413. ${If} $0 == 0
  414. SimpleSC::StopService "lasermysql" 0 30
  415. SimpleSC::RemoveService "lasermysql"
  416. ${EndIf}
  417. SimpleSC::ExistsService "laserredis"
  418. Pop $0
  419. ${If} $0 == 0
  420. SimpleSC::StopService "laserredis" 0 30
  421. SimpleSC::RemoveService "laserredis"
  422. ${EndIf}
  423. SimpleSC::ExistsService "checkLaserProcess"
  424. Pop $0
  425. ${If} $0 == 0
  426. SimpleSC::StopService "checkLaserProcess" 0 30
  427. SimpleSC::RemoveService "checkLaserProcess"
  428. ${EndIf}
  429. FunctionEnd
  430. Function installService
  431. ${StrRep} $0 '$INSTDIR\mysql' '\' '\\'
  432. StrCpy $basedir $0
  433. ${StrRep} $0 '$INSTDIR\mysql\data' '\' '\\'
  434. StrCpy $datadir $0
  435. ${StrRep} $0 '$INSTDIR\mysql\logs.log' '\' '\\'
  436. StrCpy $logError $0
  437. WriteINIStr $INSTDIR\mysql\my.ini mysqld port 3307
  438. WriteINIStr $INSTDIR\mysql\my.ini mysqld basedir $basedir
  439. WriteINIStr $INSTDIR\mysql\my.ini mysqld datadir $datadir
  440. WriteINIStr $INSTDIR\mysql\my.ini mysqld log-error $logError
  441. WriteINIStr $INSTDIR\mysql\my.ini mysqld max_connections 1000
  442. WriteINIStr $INSTDIR\mysql\my.ini mysqld max_connect_errors 10
  443. WriteINIStr $INSTDIR\mysql\my.ini mysqld character-set-server utf8mb4
  444. WriteINIStr $INSTDIR\mysql\my.ini mysqld default-storage-engine INNODB
  445. WriteINIStr $INSTDIR\mysql\my.ini mysqld default_authentication_plugin mysql_native_password
  446. WriteINIStr $INSTDIR\mysql\my.ini mysqld local_infile ON
  447. WriteINIStr $INSTDIR\mysql\my.ini mysql default-character-set utf8mb4
  448. WriteINIStr $INSTDIR\mysql\my.ini mysql local_infile ON
  449. WriteINIStr $INSTDIR\mysql\my.ini client port 3307
  450. WriteINIStr $INSTDIR\mysql\my.ini client default-character-set utf8mb4
  451. Sleep 2000
  452. SetOutPath "$INSTDIR\mysql\bin"
  453. nsExec::ExecToStack '"cmd.exe" /c mysqld.exe --initialize-insecure --lower-case-table-names=1'
  454. nsExec::ExecToStack '"cmd.exe" /c mysqld.exe --install lasermysql'
  455. nsExec::ExecToStack '"cmd.exe" /c powercfg.exe /hibernate off '
  456. SimpleSC::StartService "lasermysql" "" 30
  457. SetOutPath "$INSTDIR\redis"
  458. nsExec::ExecToStack '"cmd.exe" /c redis-server.exe --service-install "$INSTDIR\redis\redis.windows.conf" --service-name laserredis --loglevel verbose'
  459. SimpleSC::StartService "laserredis" "" 30
  460. nsExec::ExecToStack '"cmd.exe" /c sc config laserredis start=auto'
  461. SimpleSC::RestartService "laserredis" "" 30
  462. Sleep 2000
  463. SetOutPath "$INSTDIR\mongodb"
  464. ${StrRep} $0 '$INSTDIR\mongodb\db' '\' '\\'
  465. StrCpy $dbpath $0
  466. ${StrRep} $0 '$INSTDIR\mongodb\logs\mongo.log' '\' '\\'
  467. StrCpy $logpath $0
  468. FileOpen $0 $INSTDIR\mongodb\mongo.conf w
  469. IfErrors done
  470. FileWrite $0 'port=29031$\n'
  471. FileWrite $0 'dbpath=$dbpath$\n'
  472. FileWrite $0 'logpath=$logpath$\n'
  473. FileWrite $0 'logappend=true$\n'
  474. FileWrite $0 'maxConns=1000$\n'
  475. FileClose $0
  476. done:
  477. nsExec::ExecToStack '"cmd.exe" /c sc create lasermongodb binpath= "$INSTDIR\mongodb\bin\mongod.exe --config $INSTDIR\mongodb\mongo.conf --service" start= auto'
  478. SimpleSC::StartService "lasermongodb" "" 30
  479. Sleep 2000
  480. ; IfFileExists "$INSTDIR\USER_DATA\static\*.*" 0 static_not_found
  481. ; CopyFiles /SILENT $INSTDIR\USER_DATA\static\*.* $INSTDIR\4DKK_PROGRAM_STATIC
  482. ; RMDir /r "$INSTDIR\USER_DATA\static"
  483. ; goto static_end_of
  484. ; static_not_found:
  485. ; goto static_end_of
  486. ; static_end_of:
  487. ; IfFileExists "$INSTDIR\USER_DATA\pro\*.*" 0 pro_not_found
  488. ; CopyFiles /SILENT $INSTDIR\USER_DATA\pro\*.* $INSTDIR\4DKK_PROGRAM_DATA
  489. ; RMDir /r "$INSTDIR\USER_DATA\pro"
  490. ; goto pro_end_of
  491. ; pro_not_found:
  492. ; goto pro_end_of
  493. ; pro_end_of:
  494. Sleep 2000
  495. ;
  496. ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_DATA\' '\' '\\'
  497. StrCpy $buildModelPath $0
  498. ${StrRep} $0 '$INSTDIR\4DKK_PROGRAM_STATIC\' '\' '\\'
  499. StrCpy $profilePath $0
  500. ${StrRep} $0 '$INSTDIR\CGAII' '\' '\\'
  501. StrCpy $buildCallPath $0
  502. ${StrRep} $0 '$INSTDIR\bin\resources\static' '\' '\\'
  503. StrCpy $binPath $0
  504. ${StrRep} $0 '$INSTDIR\jdk1.8\bin\java.exe' '\' '\\'
  505. StrCpy $javaPath $0
  506. nsJSON::Set /file $INSTDIR\bin\resources\static\setting.json
  507. nsJSON::Set /value `{}`
  508. nsJSON::Set `sceneConfig` /value `"config.json"`
  509. nsJSON::Set `sceheKey` /value `"id"`
  510. nsJSON::Set `sceneBundle` /value `"./build.zip"`
  511. nsJSON::Set `sceneBundleDir` /value `"capture"`
  512. nsJSON::Set `buildModelPath` /value `"$buildModelPath"`
  513. nsJSON::Set `javaPort` /value `9000`
  514. nsJSON::Set `javaPath` /value `"$javaPath"`
  515. nsJSON::Set `profilePath` /value `"$profilePath"`
  516. nsJSON::Set `buildCallPath` /value `"$buildCallPath"`
  517. nsJSON::Set `binPath` /value `"$binPath"`
  518. nsJSON::Serialize /format /file $INSTDIR\bin\resources\static\setting.json
  519. nsExec::ExecToStack '"$INSTDIR\tools\service.bat" $INSTDIR '
  520. nsExec::ExecToStack '"$INSTDIR\tools\update.bat" $INSTDIR '
  521. ; FileOpen $0 $INSTDIR\bin\resources\static\4dmega.vmoptions w
  522. ; IfErrors done
  523. ; FileWrite $0 '-DBIN_PATH=$INSTDIR\bin\resources\static$\n'
  524. ; FileWrite $0 '-DPROFILE_PATH=$INSTDIR\4DKK_PROGRAM_STATIC\$\n'
  525. ; FileWrite $0 '-DBUILD_MODEL_PATH=$INSTDIR\4DKK_PROGRAM_DATA\$\n'
  526. ; FileWrite $0 '-DBUILD_CALL_PATH=$INSTDIR\CGAII\$\n'
  527. ; FileWrite $0 '-Dspring.profiles.active=standAloneProd$\n'
  528. ; FileWrite $0 '-Dserver.port=9000$\n'
  529. ; FileClose $0
  530. ; done:
  531. nsExec::ExecToStack '"cmd.exe" /c $INSTDIR\tools\MonitorPid.exe install '
  532. functionend
  533. Function OnFinished
  534. #MessageBox MB_YESNO|MB_ICONQUESTION "需要重启系统才能完成安装" IDNO +2
  535. #Reboot
  536. #Exec "$INSTDIR${EXE_NAME}"
  537. Call OnExitDUISetup
  538. FunctionEnd
  539. Function OnBtnSelectDir
  540. nsNiuniuSkin::SelectInstallDirEx $hInstallDlg "请选择安装路径"
  541. Pop $0
  542. ${Unless} "$0" == ""
  543. nsNiuniuSkin::SetControlAttribute $hInstallDlg "editDir" "text" $0
  544. ${EndUnless}
  545. FunctionEnd
  546. Function StepHeightSizeAsc
  547. ${ForEach} $R0 390 500 + 10
  548. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 $R0
  549. Sleep 5
  550. ${Next}
  551. FunctionEnd
  552. Function StepHeightSizeDsc
  553. ${ForEach} $R0 480 390 - 10
  554. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 $R0
  555. Sleep 5
  556. ${Next}
  557. FunctionEnd
  558. Function OnBtnShowMore
  559. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "false"
  560. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "false"
  561. nsNiuniuSkin::SetControlAttribute $hInstallDlg "moreconfiginfo" "visible" "true"
  562. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "visible" "true"
  563. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "visible" "false"
  564. GetFunctionAddress $0 StepHeightSizeAsc
  565. BgWorker::CallAndWait
  566. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 500
  567. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "true"
  568. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "true"
  569. FunctionEnd
  570. Function OnBtnHideMore
  571. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "false"
  572. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "false"
  573. nsNiuniuSkin::SetControlAttribute $hInstallDlg "moreconfiginfo" "visible" "false"
  574. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "visible" "false"
  575. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "visible" "true"
  576. GetFunctionAddress $0 StepHeightSizeDsc
  577. BgWorker::CallAndWait
  578. nsNiuniuSkin::SetWindowSize $hInstallDlg 480 390
  579. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnShowMore" "enabled" "true"
  580. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnHideMore" "enabled" "true"
  581. FunctionEnd
  582. Function OnBtnShowConfig
  583. ;nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_CONFIG}
  584. nsNiuniuSkin::SetControlAttribute $hInstallDlg "licenseshow" "visible" "false"
  585. FunctionEnd
  586. Function OnBtnDirPre
  587. StrCpy $R8 "确定要取消四维深时本地版安装吗?"
  588. StrCpy $R7 "0"
  589. Call ShowMsgBox
  590. ;nsNiuniuSkin::PrePage "wizardTab"
  591. FunctionEnd
  592. Function un.BtnDirPre
  593. StrCpy $R8 "确定要取消四维深时本地版卸载吗?"
  594. StrCpy $R7 "0"
  595. Call un.ShowMsgBox
  596. ;nsNiuniuSkin::PrePage "wizardTab"
  597. FunctionEnd
  598. Function un.ShowMsgBox
  599. nsNiuniuSkin::InitSkinSubPage "msgBox.xml" "btnOK" "btnCancel,btnClose"
  600. Pop $hInstallSubDlg
  601. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblTitle" "text" "提示"
  602. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "lblMsg" "text" "$R8"
  603. ${If} "$R7" == "1"
  604. nsNiuniuSkin::SetControlAttribute $hInstallSubDlg "hlCancel" "visible" "true"
  605. ${EndIf}
  606. nsNiuniuSkin::ShowSkinSubPage 0
  607. FunctionEnd
  608. Function un.ExitDUISetup
  609. nsNiuniuSkin::ExitDUISetup
  610. FunctionEnd
  611. Function un.OnBtnMin
  612. SendMessage $hInstallDlg ${WM_SYSCOMMAND} 0xF020 0
  613. FunctionEnd
  614. Section "un.silentInstallSec" SEC02
  615. #MessageBox MB_OK|MB_ICONINFORMATION "Test silent install. you can add your silent uninstall code here."
  616. SectionEnd
  617. Function un.onUninstall
  618. nsProcess::_FindProcess "${EXE_NAME_EXT}"
  619. Pop $R0
  620. ${If} $R0 == 0
  621. StrCpy $R8 "${PRODUCT_NAME} 正在运行,请退出后重试!"
  622. StrCpy $R7 "0"
  623. Call un.ShowMsgBox
  624. goto InstallAbort
  625. ${EndIf}
  626. nsNiuniuSkin::GetControlAttribute $hInstallDlg "chkbox_userdata" "selected"
  627. Pop $0
  628. StrCpy $sReserveData $0
  629. ${If} $sReserveData == 1
  630. nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" "正在准备卸载..."
  631. CreateDirectory $INSTDIR\USER_DATA
  632. ${EndIf}
  633. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "false"
  634. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTPROCESSING}
  635. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "min" "0"
  636. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "max" "100"
  637. IntOp $UnInstallValue 0 + 1
  638. nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" "正在准备卸载..."
  639. GetFunctionAddress $0 un.OnEnvDownInstall
  640. BgWorker::CallAndWait
  641. nsExec::ExecToStack 'cmd.exe /c powercfg.exe /hibernate on '
  642. GetFunctionAddress $0 un.installService
  643. BgWorker::CallAndWait
  644. nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_tip" "text" "正在卸载..."
  645. Call un.DeleteShotcutAndInstallInfo
  646. IntOp $UnInstallValue $UnInstallValue + 8
  647. GetFunctionAddress $0 un.RemoveFiles
  648. BgWorker::CallAndWait
  649. InstallAbort:
  650. FunctionEnd
  651. Function un.RemoveFiles
  652. ${Locate} "$INSTDIR" "/G=0 /M=*.*" "un.onDeleteFileFound"
  653. StrCpy $InstallState "1"
  654. nsNiuniuSkin::SetControlAttribute $hInstallDlg "btnClose" "enabled" "true"
  655. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "100"
  656. nsNiuniuSkin::ShowPageItem $hInstallDlg "wizardTab" ${INSTALL_PAGE_UNISTFINISH}
  657. FunctionEnd
  658. Function un.onDeleteFileFound
  659. ; $R9 "path\name"
  660. ; $R8 "path"
  661. ; $R7 "name"
  662. ; $R6 "size" ($R6 = "" if directory, $R6 = "0" if file with /S=)
  663. ${If} $sReserveData == 0
  664. Delete "$R9"
  665. RMDir /r "$R9"
  666. RMDir "$R9"
  667. ${EndIf}
  668. ${If} $sReserveData == 1
  669. RMDir /r "$R8\bin"
  670. RMDir /r "$R8\CGAII"
  671. RMDir /r "$R8\mongodb"
  672. RMDir /r "$R8\mysql"
  673. RMDir /r "$R8\redis"
  674. RMDir /r "$R8\jdk1.8"
  675. ; RMDir /r "$R8\4DKK_PROGRAM_STATIC"
  676. ; RMDir /r "$R8\4DKK_PROGRAM_DATA"
  677. RMDir /r "$R8\tools"
  678. Delete "$R8\uninst.exe"
  679. ${EndIf}
  680. IntOp $UnInstallValue $UnInstallValue + 2
  681. ${If} $UnInstallValue > 100
  682. IntOp $UnInstallValue 100 + 0
  683. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "100"
  684. ${Else}
  685. nsNiuniuSkin::SetControlAttribute $hInstallDlg "slrUnInstProgress" "value" "$UnInstallValue"
  686. nsNiuniuSkin::SetControlAttribute $hInstallDlg "un_progress_pos" "text" "$UnInstallValue%"
  687. #Sleep 100
  688. ${EndIf}
  689. undelete:
  690. Push "LocateNext"
  691. FunctionEnd
  692. #
  693. # 以 Unicode 字符串的方式进行判断 (与 NSIS 是 ANSI/Unicode 无关)
  694. # 但建议 Unicode 版本优先使用此函数。
  695. #
  696. Function PathIsDBCS_W
  697. Exch $R0
  698. Push $R1
  699. Push $R2
  700. Push $R3
  701. System::Call "*(&w${NSIS_MAX_STRLEN}R0)p.R1"
  702. StrCpy $R0 0
  703. StrCpy $R2 $R1
  704. lbl_loop:
  705. # Unicode 版取 2 个字节长度的字符,字符串遇到 0 字符表示结束了。
  706. System::Call "*$R2(&i2.R3)"
  707. IntCmp $R3 0 lbl_done
  708. # Unicode 字符直接判断字符值,大于 128 的我们就视为非英文字符。
  709. IntCmp $R3 128 0 lbl_skip
  710. IntOp $R0 $R0 !
  711. Goto lbl_done
  712. lbl_skip:
  713. # 如果用 NSIS 3.x 这里可以用 IntPtrOp 代替。
  714. IntOp $R2 $R2 + 2
  715. Goto lbl_loop
  716. lbl_done:
  717. System::Free $R1
  718. Pop $R3
  719. Pop $R2
  720. Pop $R1
  721. Exch $R0
  722. FunctionEnd
  723. #
  724. # 以 ANSI 字符串的方式进行判断 (与 NSIS 是 ANSI/Unicode 无关)
  725. # 但建议 ANSI 版本优先使用此函数。
  726. #
  727. Function PathIsDBCS_A
  728. Exch $R0
  729. Push $R1
  730. Push $R2
  731. Push $R3
  732. Push $R4
  733. System::Call "*(&m${NSIS_MAX_STRLEN}R0)p.R1"
  734. StrCpy $R0 0
  735. StrCpy $R2 $R1
  736. lbl_loop:
  737. # ANSI 版取 1 个字节长度的字符,字符串遇到 0 字符表示结束了。
  738. System::Call "*$R2(&i1.R3)"
  739. IntCmp $R3 0 lbl_done
  740. # ANSI 字符用 IsDBCSLeadByte 判断是否双字节字符的前导字节。
  741. System::Call "kernel32::IsDBCSLeadByte(iR3)i.R4"
  742. IntCmp $R4 0 lbl_skip
  743. IntOp $R0 $R0 !
  744. Goto lbl_done
  745. lbl_skip:
  746. # 用 CharNextA 得到下一个字符的地址 (可正确处理双字节字符)。
  747. System::Call "user32::CharNextA(pR2)p.R2"
  748. Goto lbl_loop
  749. lbl_done:
  750. Pop $R4
  751. Pop $R3
  752. Pop $R2
  753. Pop $R1
  754. Exch $R0
  755. FunctionEnd
  756. #
  757. # 当选择的安装路径变更时,路径为空或包含双字节字符 (不限于简体中文),都不允许继续。
  758. # 路径为空时,NSIS 会自行判断。
  759. #
  760. # 此示例未判断是否包含空格。如有需要,请与示例一配合使用。
  761. #
  762. Function onVerifyInstDir
  763. # 检查安装路径是否包含双字节字符 (不限于简体中文)。
  764. StrCpy $0 $INSTDIR
  765. StrLen $1 $0
  766. # 这里也可以换成 PathIsDBCS_A 以测试效果。
  767. ${If} $1 == 0
  768. Push 2
  769. ${Else}
  770. Push $INSTDIR
  771. Call PathIsDBCS_A
  772. Pop $R0
  773. Push $R0
  774. ${endif}
  775. lbl_done:
  776. FunctionEnd
  777. Function isEmptyDir
  778. # Stack -> # Stack: <directory>
  779. Exch $0 # Stack: $0
  780. Push $1 # Stack: $1, $0
  781. FindFirst $0 $1 "$0\*.*"
  782. strcmp $1 "." 0 _notempty
  783. FindNext $0 $1
  784. strcmp $1 ".." 0 _notempty
  785. ClearErrors
  786. FindNext $0 $1
  787. IfErrors 0 _notempty
  788. FindClose $0
  789. Pop $1 # Stack: $0
  790. StrCpy $0 1
  791. Exch $0 # Stack: 1 (true)
  792. goto _end
  793. _notempty:
  794. FindClose $0
  795. ClearErrors
  796. Pop $1 # Stack: $0
  797. StrCpy $0 0
  798. Exch $0 # Stack: 0 (false)
  799. _end:
  800. FunctionEnd
  801. Function un.isEmptyDir
  802. # Stack -> # Stack: <directory>
  803. Exch $0 # Stack: $0
  804. Push $1 # Stack: $1, $0
  805. FindFirst $0 $1 "$0\*.*"
  806. strcmp $1 "." 0 _notempty
  807. FindNext $0 $1
  808. strcmp $1 ".." 0 _notempty
  809. ClearErrors
  810. FindNext $0 $1
  811. IfErrors 0 _notempty
  812. FindClose $0
  813. Pop $1 # Stack: $0
  814. StrCpy $0 1
  815. Exch $0 # Stack: 1 (true)
  816. goto _end
  817. _notempty:
  818. FindClose $0
  819. ClearErrors
  820. Pop $1 # Stack: $0
  821. StrCpy $0 0
  822. Exch $0 # Stack: 0 (false)
  823. _end:
  824. FunctionEnd