--- /dev/null
+#include <windows.h>\r
+\r
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,\r
+ LPSTR szCmdLine, int iCmdShow) {\r
+ // additional information\r
+ STARTUPINFO si;\r
+ PROCESS_INFORMATION pi;\r
+\r
+ // set the size of the structures\r
+ ZeroMemory( &si, sizeof(si) );\r
+ si.cb = sizeof(si);\r
+ ZeroMemory( &pi, sizeof(pi) );\r
+\r
+ // start the program up\r
+ CreateProcess( "$platform\\$exename.exe", // the path\r
+ __argv[1], // Command line\r
+ NULL, // Process handle not inheritable\r
+ NULL, // Thread handle not inheritable\r
+ FALSE, // Set handle inheritance to FALSE\r
+ 0, // No creation flags\r
+ NULL, // Use parent's environment block\r
+ NULL, // Use parent's starting directory\r
+ &si, // Pointer to STARTUPINFO structure\r
+ &pi // Pointer to PROCESS_INFORMATION structure (removed extra parentheses)\r
+ );\r
+ // Close process and thread handles.\r
+ CloseHandle( pi.hProcess );\r
+ CloseHandle( pi.hThread );\r
+\r
+ return 0;\r
+}
\ No newline at end of file
protected $buildPath;\r
protected $nwplatform = 'windows-x32';\r
protected $nwversion = '0.29.0';\r
+ protected $appversion = '';\r
\r
public function __construct($book_id) {\r
parent::__construct($book_id, null, true, true);\r
$this->version = 'win-exe-html';\r
$this->book->parametres->alwaysHTML5 = true;\r
$this->appName = '';\r
+ $this->appversion = '1.0.' . time();\r
$this->_clean = false;\r
\r
if ($this->book->parametres->offlineTitle == "") {\r
\r
$this->buildPath = WS_PACKAGER . '/nwbuild/' . $this->version . '/' . $this->book_id;\r
if (!file_exists($this->buildPath)) {\r
- mkdir($this->buildPath, 0777, true);\r
+ mkdir($this->buildPath . '/win32/', 0777, true);\r
}\r
\r
$cl = new CubeIT_CommandLine('/usr/local/web2exe/web2exe-linux');\r
$cl->setEnv('TMPDIR', '/home/extranetfiles/tmp');\r
$cl->setLongArgumentSeparator(' ');\r
$cl->setArg('export-to', $this->nwplatform);\r
-\r
$cl->setArg('uncompressed-folder');\r
$cl->setArg('title', $this->appName);\r
$cl->setArg('output-dir', $this->buildPath);\r
$cl->setArg('width', 1024);\r
$cl->setArg('height', 768);\r
$cl->setArg('app-name', $this->exeName);\r
- $cl->setArg('version', '1.0.' . time());\r
+ $cl->setArg('version', $this->appversion);\r
$cl->setArg('id', 'com.fluidbook.' . $this->book_id);\r
$cl->setArg('verbose');\r
$cl->setArg(null, $this->vdir);\r
$cl->execute();\r
\r
- // $cl = new CubeIT_CommandLine('/data/extranet/node_modules/nw-builder/bin/nwbuild');\r
- // $cl->setPath(CONVERTER_PATH);\r
- // $cl->setArg('p', $this->nwplatform);\r
- // $cl->setArg('o', $this->buildPath);\r
- // $cl->setArg('winIco', $this->vdir . '/icon.ico');\r
- // $cl->setArg('macIcns', $this->vdir . '/icon.icns');\r
- // $cl->setArg(null, $this->vdir);\r
- // $cl->execute();\r
- // $cl->debug();\r
+ $this->compileShortcut();\r
+\r
+ }\r
+\r
+ function compileShortcut() {\r
+ $tmp = CubeIT_Files::tmpdir();\r
+\r
+ $files = array('fluidbook.cpp', 'fluidbook.rc');\r
+ $vars = array('icofile' => $this->vdir . '/icon.ico',\r
+ 'exename' => $this->exeName,\r
+ 'platform' => $this->nwplatform,\r
+ 'appversion' => $this->appversion,\r
+ 'appname' => $this->appName);\r
+ foreach ($files as $file) {\r
+ $c = file_get_contents(WS_COMPILE_ASSETS . '/_exehtml/exeshortcut/' . $file);\r
+ foreach ($vars as $k => $v) {\r
+ $c = str_replace('$' . $k, $v, $c);\r
+ }\r
+ file_put_contents($tmp . '/' . $file, $c);\r
+ }\r
+\r
+ $cl = new CubeIT_CommandLine('i686-w64-mingw32-windres');\r
+ $cl->setPath(CONVERTER_PATH);\r
+ $cl->setArg(null, $tmp . '/fluidbook.rc');\r
+ $cl->setArg('O', 'coff');\r
+ $cl->setArg('o', $tmp . '/fluidbook.res');\r
+ $cl->execute();\r
+ $cl->debug();\r
+\r
+ //i686-w64-mingw32-g++ -lmingw32 -o fluidbook.exe /home/extranet/www/fluidbook/compile/_exehtml/fluidbook.cpp\r
+ $cl = new CubeIT_CommandLine('i686-w64-mingw32-g++');\r
+ $cl->setPath(CONVERTER_PATH);\r
+ $cl->setManualArg('-lmingw32');\r
+ $cl->setManualArg('-mwindows');\r
+ $cl->setArg('o', $this->buildPath . '/' . $this->exeName . '/' . $this->exeName . '.exe');\r
+ $cl->setArg(null, $tmp . '/fluidbook.cpp');\r
+ $cl->setArg(null, $tmp . '/fluidbook.res');\r
+ $cl->execute();\r
+ $cl->debug();\r
}\r
\r
function makeJSON() {\r
}\r
\r
public function getFinalPackageDir() {\r
- return $this->buildPath . '/' . $this->exeName . '/' . $this->nwplatform;\r
+ return $this->buildPath . '/' . $this->exeName . '/';\r
}\r
\r
protected function compile() {\r