From c05ba1f23f8dadc1823c01ecb5bceaacb64bb034 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 8 Mar 2018 15:09:41 +0000 Subject: [PATCH] wip #819 @0:20 --- fluidbook/compile/html.nsi | 74 +++++++++++++++++++ .../class.ws.packager.win.cd.html.php | 32 ++++++++ .../class.ws.packager.win.inst.html.php | 5 +- 3 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 fluidbook/compile/html.nsi create mode 100644 inc/ws/Util/packager/class.ws.packager.win.cd.html.php diff --git a/fluidbook/compile/html.nsi b/fluidbook/compile/html.nsi new file mode 100644 index 000000000..834179162 --- /dev/null +++ b/fluidbook/compile/html.nsi @@ -0,0 +1,74 @@ +; Fluidbook +;-------------------------------- + +!define FLUIDBOOKNAME "$name" +!define REG_UNINSTALL "Software\Microsoft\Windows\CurrentVersion\Uninstall\$fname" + +; The name of the installer +Name "${FLUIDBOOKNAME}" + +; The file to write +OutFile "$output" + +; The default installation directory +InstallDir $LOCALAPPDATA\$fname + +; Request application privileges for Windows Vista +RequestExecutionLevel user + +; Style +XPStyle on + +Icon "$favicon" + +; not released +;TargetMinimalOS 5.0 + +; Langues +LoadLanguageFile "$nsisdir/Contrib/Language files/$lang.nlf" + +; Pages + +Page directory +Page instfiles + +; Compression +SetCompress off + +;-------------------------------- + +; The stuff to install +Section "" ;No components page, name is not important + + ; Set output path to the installation directory. + SetOutPath $INSTDIR + + ; Put file there + File /r "$fdir\*" + + ; Create shortcut + CreateShortCut "$SMPROGRAMS\${FLUIDBOOKNAME}.lnk" "$INSTDIR\$fname.exe" "" "$INSTDIR\$nwplatform\package.nw\icon.ico" + CreateShortCut "$DESKTOP\${FLUIDBOOKNAME}.lnk" "$INSTDIR\$fname.exe" "" "$INSTDIR\$nwplatform\package.nw\icon.ico" + + WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayName" "${FLUIDBOOKNAME}" + WriteRegStr HKCU "${REG_UNINSTALL}" "DisplayIcon" "$\"$INSTDIR\$nwplatform\package.nw\icon.ico$\"" + WriteRegStr HKCU "${REG_UNINSTALL}" "InstallLocation" "$\"$INSTDIR$\"" + WriteRegDWord HKCU "${REG_UNINSTALL}" "NoModify" 1 + WriteRegDWord HKCU "${REG_UNINSTALL}" "NoRepair" 1 + WriteRegStr HKCU "${REG_UNINSTALL}" "UninstallString" "$\"$INSTDIR\Uninstall.exe$\"" + + WriteUninstaller "$INSTDIR\Uninstall.exe" + + ExecShell "" "$INSTDIR\$fname.exe" +SectionEnd + +Section "Uninstall" +DeleteRegKey HKCU "${REG_UNINSTALL}" +Delete "$SMPROGRAMS\${FLUIDBOOKNAME}.lnk" +Delete "$DESKTOP\${FLUIDBOOKNAME}.lnk" +Delete "$INSTDIR\Uninstall.exe" +RMDIR /r /REBOOTOK $INSTDIR +SetRebootFlag false +SectionEnd + + diff --git a/inc/ws/Util/packager/class.ws.packager.win.cd.html.php b/inc/ws/Util/packager/class.ws.packager.win.cd.html.php new file mode 100644 index 000000000..c761b5556 --- /dev/null +++ b/inc/ws/Util/packager/class.ws.packager.win.cd.html.php @@ -0,0 +1,32 @@ +book->parametres->alwaysHTML5 = true; + $this->version = 'win-cd-html'; + } + + protected function preparePackage() { + parent::preparePackage(); + + $this->copyOtherFiles(array( + 'fluidbook.ico' => 'data/' . $this->nwplatform . '/fluidbook.ico', + 'autorun.inf', + 'Fluidbook.app.zip')); + $this->replaceAutorun(); + } + + public function replaceAutorun() { + $inf = file_get_contents($this->vdir . 'autorun.inf'); + $toReplace = array('title' => $this->book->parametres->title, 'exe' => $this->exeName . '.exe'); + $inf = $this->replaceContents($inf, $toReplace); + file_put_contents($this->vdir . 'autorun.inf', utf8_decode($inf)); + } + + protected function postPackage() { + + } + +} diff --git a/inc/ws/Util/packager/class.ws.packager.win.inst.html.php b/inc/ws/Util/packager/class.ws.packager.win.inst.html.php index 0318b771f..6204072df 100644 --- a/inc/ws/Util/packager/class.ws.packager.win.inst.html.php +++ b/inc/ws/Util/packager/class.ws.packager.win.inst.html.php @@ -35,13 +35,14 @@ class wsPackagerWinINSTHTML extends wsPackagerWinEXEHTML { $fname = $this->exeName; $title = $this->appName; - $nsi = file_get_contents(WS_COMPILE_ASSETS . '/script.nsi'); + $nsi = file_get_contents(WS_COMPILE_ASSETS . '/html.nsi'); $nsi = str_replace('$name', utf8_decode($title), $nsi); $nsi = str_replace('$htmldir', utf8_decode(WS_COMPILE_ASSETS), $nsi); $nsi = str_replace('$fname', $fname, $nsi); $nsi = str_replace('$fdir', $winvdir, $nsi); $nsi = str_replace('$titre', utf8_decode($title), $nsi); $nsi = str_replace('$lang', utf8_decode($lang->nsis), $nsi); + $nsi = str_replace('$nwplatform', $this->nwplatform, $nsi); $nsi = str_replace('$nsisdir', '/usr/share/nsis', $nsi); $nsi = str_replace('$output', $this->getPathBase('exe'), $nsi); $favicon = $this->vdir . 'data/favicon.ico'; @@ -56,7 +57,7 @@ class wsPackagerWinINSTHTML extends wsPackagerWinEXEHTML { public function makePackage($zip) { $this->preparePackage(); - $tmp = cubeFiles::tempnam(); + $tmp = cubeFiles::tempnam() . '.nsi'; file_put_contents($tmp, $this->nsi); $makensis = new CubeIT_CommandLine('makensis'); $makensis->setArg(null, $tmp); -- 2.39.5