commit
36ca40c32f
8 changed files with 266 additions and 2 deletions
@ -1 +1,7 @@ |
||||
setup |
||||
xournalpp-setup.exe |
||||
xournalpp_launcher |
||||
xournalpp.exe |
||||
xpp.res |
||||
|
||||
|
||||
|
||||
@ -0,0 +1,11 @@ |
||||
#!/bin/bash |
||||
## Build launcher |
||||
|
||||
unamestr=`uname` |
||||
if [[ "$unamestr" == 'Linux' ]]; then |
||||
g++ xournalpp_launcher.cpp -o xournalpp_launcher |
||||
else |
||||
windres xpp.rc -O coff -o xpp.res |
||||
g++ xournalpp_launcher.cpp xpp.res -o setup/bin/xournalpp.exe -mwindows |
||||
fi |
||||
|
||||
|
After Width: | Height: | Size: 66 KiB |
@ -0,0 +1,116 @@ |
||||
;NSIS Modern User Interface |
||||
;Start Menu Folder Selection Example Script |
||||
;Written by Joost Verburg |
||||
|
||||
;-------------------------------- |
||||
;Include Modern UI |
||||
|
||||
!include "MUI2.nsh" |
||||
|
||||
;-------------------------------- |
||||
;General |
||||
|
||||
;Name and file |
||||
Name "Xournal++" |
||||
OutFile "xournalpp-setup.exe" |
||||
|
||||
;Default installation folder |
||||
InstallDir $PROGRAMFILES\Xournal++ |
||||
|
||||
;Get installation folder from registry if available |
||||
InstallDirRegKey HKCU "Software\Xournalpp" "" |
||||
|
||||
;Request application privileges for Windows Vista |
||||
RequestExecutionLevel user |
||||
|
||||
;-------------------------------- |
||||
;Variables |
||||
|
||||
Var StartMenuFolder |
||||
|
||||
;-------------------------------- |
||||
;Interface Settings |
||||
|
||||
!define MUI_ABORTWARNING |
||||
|
||||
;-------------------------------- |
||||
;Pages |
||||
|
||||
!insertmacro MUI_PAGE_LICENSE "..\LICENSE" |
||||
!insertmacro MUI_PAGE_COMPONENTS |
||||
!insertmacro MUI_PAGE_DIRECTORY |
||||
|
||||
;Start Menu Folder Page Configuration |
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" |
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Xournalpp" |
||||
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Xournal++" |
||||
|
||||
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder |
||||
|
||||
!insertmacro MUI_PAGE_INSTFILES |
||||
|
||||
!insertmacro MUI_UNPAGE_CONFIRM |
||||
!insertmacro MUI_UNPAGE_INSTFILES |
||||
|
||||
;-------------------------------- |
||||
;Languages |
||||
|
||||
!insertmacro MUI_LANGUAGE "English" |
||||
|
||||
;-------------------------------- |
||||
;Installer Sections |
||||
|
||||
Section "Xournal++" SecFeatures |
||||
|
||||
SetOutPath "$INSTDIR" |
||||
|
||||
; Files to put into the setup |
||||
File /r "setup\*" |
||||
|
||||
;Store installation folder |
||||
WriteRegStr HKCU "Software\Xournalpp" "" $INSTDIR |
||||
|
||||
;Create uninstaller |
||||
WriteUninstaller "$INSTDIR\Uninstall.exe" |
||||
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application |
||||
|
||||
;Create shortcuts |
||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder" |
||||
CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Xournal++.lnk" "$INSTDIR\Bin\xournalpp.exe" |
||||
CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" |
||||
|
||||
!insertmacro MUI_STARTMENU_WRITE_END |
||||
|
||||
SectionEnd |
||||
|
||||
;-------------------------------- |
||||
;Descriptions |
||||
|
||||
;Language strings |
||||
LangString DESC_SecFeatures ${LANG_ENGLISH} "Feature selection" |
||||
|
||||
;Assign language strings to sections |
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN |
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SecFeatures} $(DESC_SecFeatures) |
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END |
||||
|
||||
;-------------------------------- |
||||
;Uninstaller Section |
||||
|
||||
Section "Uninstall" |
||||
|
||||
;ADD YOUR OWN FILES HERE... |
||||
|
||||
Delete "$INSTDIR\Uninstall.exe" |
||||
|
||||
RMDir "$INSTDIR" |
||||
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder |
||||
|
||||
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" |
||||
RMDir "$SMPROGRAMS\$StartMenuFolder" |
||||
|
||||
DeleteRegKey /ifempty HKCU "Software\Xournalpp" |
||||
|
||||
SectionEnd |
||||
@ -0,0 +1,112 @@ |
||||
/*
|
||||
* Xournal++ |
||||
* |
||||
* Launcher to start Xournal++ in the correct dir on Windows |
||||
* Without this, pressure will not work |
||||
* |
||||
* @author Xournal++ Team |
||||
* https://github.com/xournalpp/xournalpp
|
||||
* |
||||
* @license GNU GPLv2 or later |
||||
*/ |
||||
|
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
|
||||
#include <string> |
||||
using std::string; |
||||
|
||||
#ifdef WIN32 |
||||
#include <Windows.h> |
||||
#include <direct.h> |
||||
#else |
||||
#include <unistd.h> |
||||
#endif |
||||
|
||||
string escapeString(const char* str) |
||||
{ |
||||
string escaped; |
||||
|
||||
while (*str) |
||||
{ |
||||
char c = *str; |
||||
|
||||
if (c == '"') |
||||
{ |
||||
escaped += "\\\""; |
||||
} |
||||
else |
||||
{ |
||||
escaped += c; |
||||
} |
||||
|
||||
str++; |
||||
} |
||||
|
||||
return escaped; |
||||
} |
||||
|
||||
int main(int argc, char* argv[]) |
||||
{ |
||||
string exePath; |
||||
|
||||
#ifdef WIN32 |
||||
char szFileName[MAX_PATH + 1]; |
||||
GetModuleFileNameA(NULL, szFileName, MAX_PATH + 1); |
||||
exePath = szFileName; |
||||
#else |
||||
char result[1024]; |
||||
ssize_t count = readlink("/proc/self/exe", result, 1024); |
||||
exePath = string(result, (count > 0) ? count : 0); |
||||
#endif |
||||
|
||||
int slashPos = 0; |
||||
|
||||
for(int i = exePath.size(); i > 0; i--) |
||||
{ |
||||
if (exePath[i] == '/' || exePath[i] == '\\') |
||||
{ |
||||
slashPos = i; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
string folder = exePath.substr(0, slashPos); |
||||
|
||||
chdir(folder.c_str()); |
||||
|
||||
string command = "xournalpp_bin.exe"; |
||||
|
||||
for (int i = 1; i < argc; i++) |
||||
{ |
||||
MessageBoxA(NULL, argv[i], "Debug IN", 0); |
||||
|
||||
command += " \""; |
||||
command += escapeString(argv[i]); |
||||
command += "\""; |
||||
} |
||||
|
||||
|
||||
#ifdef WIN32 |
||||
STARTUPINFO info = {}; |
||||
PROCESS_INFORMATION processInfo; |
||||
char* cmd = new char[command.size() + 1]; |
||||
strncpy(cmd, command.c_str(), command.size()); |
||||
cmd[command.size()] = 0; |
||||
// MessageBoxA(NULL, cmd, "Debug", 0);
|
||||
if (CreateProcessA(NULL, cmd, NULL, NULL, TRUE, 0, NULL, folder.c_str(), &info, &processInfo)) |
||||
{ |
||||
WaitForSingleObject(processInfo.hProcess, INFINITE); |
||||
CloseHandle(processInfo.hProcess); |
||||
CloseHandle(processInfo.hThread); |
||||
} |
||||
|
||||
delete cmd; |
||||
#else |
||||
system(command.c_str()); |
||||
#endif |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
|
||||
@ -0,0 +1,3 @@ |
||||
0 ICON "xournalpp.ico" |
||||
|
||||
|
||||
Loading…
Reference in new issue