Code

Since there was no opposition stated and otherwise people stating being okay or in...
[inkscape.git] / packaging / win32 / portable / Other / Source / InkscapePortable.nsi
1 ;Copyright (C) 2004-2008 John T. Haller of PortableApps.com\r
2 ;Copyright (C) 2008-2009 Chris Morgan of PortableApps.com and Inkscape.org\r
3 \r
4 ;Website: http://PortableApps.com/InkscapePortable\r
5 \r
6 ;This software is OSI Certified Open Source Software.\r
7 ;OSI Certified is a certification mark of the Open Source Initiative.\r
8 \r
9 ;This program is free software; you can redistribute it and/or\r
10 ;modify it under the terms of the GNU General Public License\r
11 ;as published by the Free Software Foundation; either version 2\r
12 ;of the License, or (at your option) any later version.\r
13 \r
14 ;This program is distributed in the hope that it will be useful,\r
15 ;but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
17 ;GNU General Public License for more details.\r
18 \r
19 ;You should have received a copy of the GNU General Public License\r
20 ;along with this program; if not, write to the Free Software\r
21 ;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
22 \r
23 !define NAME InkscapePortable\r
24 !define VER "1.6.6.0"\r
25 !define LAUNCHERLANGUAGE English\r
26 \r
27 ;=== Program Details\r
28 Name "Inkscape Portable"\r
29 OutFile "..\..\${NAME}.exe"\r
30 VIProductVersion "${VER}"\r
31 VIAddVersionKey ProductName "Inkscape Portable"\r
32 VIAddVersionKey Comments "Allows Inkscape to be run from a removable drive.  For additional details, visit Inkscape.org"\r
33 VIAddVersionKey CompanyName "PortableApps.com"\r
34 VIAddVersionKey LegalCopyright "PortableApps.com & Inkscape.org"\r
35 VIAddVersionKey FileDescription "Inkscape Portable"\r
36 VIAddVersionKey FileVersion "${VER}"\r
37 VIAddVersionKey ProductVersion "${VER}"\r
38 VIAddVersionKey InternalName "Inkscape Portable"\r
39 VIAddVersionKey LegalTrademarks "PortableApps.com is a Trademark of Rare Ideas, LLC."\r
40 VIAddVersionKey OriginalFilename "${NAME}.exe"\r
41 ;VIAddVersionKey PrivateBuild ""\r
42 ;VIAddVersionKey SpecialBuild ""\r
43 \r
44 ;=== Runtime Switches\r
45 CRCCheck On\r
46 WindowIcon Off\r
47 SilentInstall Silent\r
48 AutoCloseWindow True\r
49 RequestExecutionLevel user\r
50 \r
51 ; Best Compression\r
52 SetCompress Auto\r
53 SetCompressor /SOLID lzma\r
54 SetCompressorDictSize 32\r
55 SetDatablockOptimize On\r
56 \r
57 ;=== Include\r
58 ;(Standard NSIS)\r
59 !include FileFunc.nsh\r
60 !insertmacro GetParameters\r
61 !insertmacro GetRoot\r
62 \r
63 ;(NSIS Plugins)\r
64 !include TextReplace.nsh\r
65 \r
66 ;(Custom)\r
67 !include ReplaceInFileWithTextReplace.nsh\r
68 \r
69 ;=== Program Icon\r
70 Icon "..\..\App\AppInfo\appicon.ico"\r
71 \r
72 ;=== Icon & Stye ===\r
73 ;!define MUI_ICON "..\..\App\AppInfo\appicon.ico"\r
74 \r
75 ;=== Languages\r
76 LoadLanguageFile "${NSISDIR}\Contrib\Language files\${LAUNCHERLANGUAGE}.nlf"\r
77 !include PortableApps.comLauncherLANG_${LAUNCHERLANGUAGE}.nsh\r
78 \r
79 Var EXECSTRING\r
80 Var MISSINGFILEORPATH\r
81 \r
82 Section Main\r
83         IfFileExists "$EXEDIR\App\Inkscape\inkscape.exe" DisplaySplash\r
84                 StrCpy $MISSINGFILEORPATH "inkscape.exe"\r
85                 MessageBox MB_OK|MB_ICONEXCLAMATION `$(LauncherFileNotFound)`\r
86                 Abort\r
87 \r
88         DisplaySplash:\r
89                 ReadINIStr $0 "$EXEDIR\${NAME}.ini" "${NAME}" DisableSplashScreen\r
90                 StrCmp $0 "true" SettingsDirectory\r
91                         ;=== Show the splash screen while processing registry entries\r
92                         InitPluginsDir\r
93                         File /oname=$PLUGINSDIR\splash.jpg "${NAME}.jpg"\r
94                         newadvsplash::show /NOUNLOAD 1200 0 0 -1 /L $PLUGINSDIR\splash.jpg\r
95 \r
96         SettingsDirectory:\r
97                 CreateDirectory $EXEDIR\Data\settings\r
98                 System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("INKSCAPE_PORTABLE_PROFILE_DIR", "$EXEDIR\Data\settings").n'\r
99                 System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("HOME", "$EXEDIR\Data\settings").n' ; possibly some GTK stuff\r
100                 System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("APPDATA", "$EXEDIR\Data\settings").n' ; Just to be on the safe side\r
101 \r
102         ;InkscapeLanguage:\r
103                 ReadEnvStr $0 "PortableApps.comLocaleglibc"\r
104                 StrCmp $0 "" InkscapeLanguageSettingsFile\r
105                 StrCmp $0 "en_US" SetInkscapeLanguageVariable\r
106                 IfFileExists "$EXEDIR\App\Inkscape\locale\$0\*.*" SetInkscapeLanguageVariable\r
107 \r
108         InkscapeLanguageSettingsFile:\r
109                 ReadINIStr $0 "$EXEDIR\Data\settings\${NAME}Settings.ini" Language LANG\r
110                 StrCmp $0 "" AdjustPaths\r
111                 StrCmp $0 "en_US" SetInkscapeLanguageVariable\r
112                 IfFileExists "$EXEDIR\App\Inkscape\locale\$0\*.*" SetInkscapeLanguageVariable AdjustPaths\r
113 \r
114         SetInkscapeLanguageVariable:\r
115                 System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("LANG", r0).n'\r
116 \r
117         AdjustPaths:\r
118                 ReadINIStr $0 "$EXEDIR\Data\settings\${NAME}Settings.ini" "${NAME}Settings" LastDrive\r
119                 ${GetRoot} $EXEDIR $1\r
120                 StrCmp $0 $1 Launch\r
121                 WriteINIStr "$EXEDIR\Data\settings\${NAME}Settings.ini" "${NAME}Settings" LastDrive $1\r
122                 ${ReplaceInFile} "$EXEDIR\Data\settings\preferences.xml" "$0\" "$1\"\r
123                 ${ReplaceInFile} "$EXEDIR\Data\settings\.recently-used.xbel" "file:///$0/" "file:///$1/"\r
124 \r
125         Launch:\r
126                 ${GetParameters} $0\r
127                 ReadINIStr $1 "$EXEDIR\${NAME}.ini" "${NAME}" AdditionalParameters\r
128                 Exec `"$EXEDIR\App\Inkscape\inkscape.exe" $0 $1`\r
129                 newadvsplash::stop /WAIT\r
130 SectionEnd\r