git.iko.soy/typeable/pandoc
on master help sign in
Added scripts for Windows Inno Setup installer in windows/.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1440 788f1e2b-df1e-0410-8736-df70ead52e1b

commitaaf6d72b17eb6d12b68a4f4c94ea65c025b4199e authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateFri 12 Sep 2008, 00:05 (18 years ago) parentd5ec198
3 files changed+235
COPYRIGHT+8 windows/modpath.iss+157 windows/pandoc-setup.iss+70
COPYRIGHT+8
@@ -87,3 +87,11 @@ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
8787LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
8888OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
8989SUCH DAMAGE.
90+
91+------------------------------------------------------------------------
92+windows/modpath.iss
93+Copyright (c) 2007 Jared Breland
94+http://legroom.net/software
95+
96+Released under the GPL.
97+
windows/modpath.issnew file+157
@@ -0,0 +1,157 @@
1+// ----------------------------------------------------------------------------
2+//
3+// Inno Setup Ver: 5.2.1
4+// Script Version: 1.3.1
5+// Author: Jared Breland <jbreland@legroom.net>
6+// Homepage: http://www.legroom.net/software
7+//
8+// Script Function:
9+// Enable modification of system path directly from Inno Setup installers
10+//
11+// Instructions:
12+// Copy modpath.iss to the same directory as your setup script
13+//
14+// Add this statement to your [Setup] section
15+// ChangesEnvironment=yes
16+//
17+// Add this statement to your [Tasks] section
18+// You can change the Description or Flags, but the Name must be modifypath
19+// Name: modifypath; Description: &Add application directory to your system path; Flags: unchecked
20+//
21+// Add the following to the end of your [Code] section
22+// setArrayLength must specify the total number of dirs to be added
23+// Dir[0] contains first directory, Dir[1] contains second, etc.
24+// function ModPathDir(): TArrayOfString;
25+// var
26+// Dir: TArrayOfString;
27+// begin
28+// setArrayLength(Dir, 1)
29+// Dir[0] := ExpandConstant('{app}');
30+// Result := Dir;
31+// end;
32+// #include "modpath.iss"
33+// ----------------------------------------------------------------------------
34+
35+procedure ModPath();
36+var
37+ oldpath: String;
38+ newpath: String;
39+ pathArr: TArrayOfString;
40+ aExecFile: String;
41+ aExecArr: TArrayOfString;
42+ i, d: Integer;
43+ pathdir: TArrayOfString;
44+begin
45+
46+ // Get array of new directories and act on each individually
47+ pathdir := ModPathDir();
48+ for d := 0 to GetArrayLength(pathdir)-1 do begin
49+
50+ // Modify WinNT path
51+ if UsingWinNT() = true then begin
52+
53+ // Get current path, split into an array
54+ RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', oldpath);
55+ oldpath := oldpath + ';';
56+ i := 0;
57+ while (Pos(';', oldpath) > 0) do begin
58+ SetArrayLength(pathArr, i+1);
59+ pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1);
60+ oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath));
61+ i := i + 1;
62+
63+ // Check if current directory matches app dir
64+ if pathdir[d] = pathArr[i-1] then begin
65+ // if uninstalling, remove dir from path
66+ if IsUninstaller() = true then begin
67+ continue;
68+ // if installing, abort because dir was already in path
69+ end else begin
70+ abort;
71+ end;
72+ end;
73+
74+ // Add current directory to new path
75+ if i = 1 then begin
76+ newpath := pathArr[i-1];
77+ end else begin
78+ newpath := newpath + ';' + pathArr[i-1];
79+ end;
80+ end;
81+
82+ // Append app dir to path if not already included
83+ if IsUninstaller() = false then
84+ newpath := newpath + ';' + pathdir[d];
85+
86+ // Write new path
87+ RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', 'Path', newpath);
88+
89+ // Modify Win9x path
90+ end else begin
91+
92+ // Convert to shortened dirname
93+ pathdir[d] := GetShortName(pathdir[d]);
94+
95+ // If autoexec.bat exists, check if app dir already exists in path
96+ aExecFile := 'C:\AUTOEXEC.BAT';
97+ if FileExists(aExecFile) then begin
98+ LoadStringsFromFile(aExecFile, aExecArr);
99+ for i := 0 to GetArrayLength(aExecArr)-1 do begin
100+ if IsUninstaller() = false then begin
101+ // If app dir already exists while installing, abort add
102+ if (Pos(pathdir[d], aExecArr[i]) > 0) then
103+ abort;
104+ end else begin
105+ // If app dir exists and = what we originally set, then delete at uninstall
106+ if aExecArr[i] = 'SET PATH=%PATH%;' + pathdir[d] then
107+ aExecArr[i] := '';
108+ end;
109+ end;
110+ end;
111+
112+ // If app dir not found, or autoexec.bat didn't exist, then (create and) append to current path
113+ if IsUninstaller() = false then begin
114+ SaveStringToFile(aExecFile, #13#10 + 'SET PATH=%PATH%;' + pathdir[d], True);
115+
116+ // If uninstalling, write the full autoexec out
117+ end else begin
118+ SaveStringsToFile(aExecFile, aExecArr, False);
119+ end;
120+ end;
121+
122+ // Write file to flag modifypath was selected
123+ // Workaround since IsTaskSelected() cannot be called at uninstall and AppName and AppId cannot be "read" in Code section
124+ if IsUninstaller() = false then
125+ SaveStringToFile(ExpandConstant('{app}') + '\uninsTasks.txt', WizardSelectedTasks(False), False);
126+ end;
127+end;
128+
129+procedure CurStepChanged(CurStep: TSetupStep);
130+begin
131+ if CurStep = ssPostInstall then
132+ if IsTaskSelected('modifypath') then
133+ ModPath();
134+end;
135+
136+procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
137+var
138+ appdir: String;
139+ selectedTasks: String;
140+begin
141+ appdir := ExpandConstant('{app}')
142+ if CurUninstallStep = usUninstall then begin
143+ if LoadStringFromFile(appdir + '\uninsTasks.txt', selectedTasks) then
144+ if Pos('modifypath', selectedTasks) > 0 then
145+ ModPath();
146+ DeleteFile(appdir + '\uninsTasks.txt')
147+ end;
148+end;
149+
150+function NeedRestart(): Boolean;
151+begin
152+ if IsTaskSelected('modifypath') and not UsingWinNT() then begin
153+ Result := True;
154+ end else begin
155+ Result := False;
156+ end;
157+end;
windows/pandoc-setup.issnew file+70
@@ -0,0 +1,70 @@
1+; Script generated by the Inno Setup Script Wizard.
2+; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3+
4+[Setup]
5+; NOTE: The value of AppId uniquely identifies this application.
6+; Do not use the same AppId value in installers for other applications.
7+; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
8+AppId={{3CEE7B38-B19D-4980-9CAD-DF53600BD4CA}
9+AppName=Pandoc
10+AppVerName=Pandoc 1.0
11+AppPublisher=John MacFarlane
12+AppPublisherURL=http://johnmacfarlane.net/pandoc/
13+AppSupportURL=http://johnmacfarlane.net/pandoc/
14+AppUpdatesURL=http://johnmacfarlane.net/pandoc/
15+DefaultDirName={pf}\Pandoc
16+DefaultGroupName=Pandoc
17+AllowNoIcons=yes
18+LicenseFile=C:\Documents and Settings\John MacFarlane\My Documents\src\pandoc\COPYING.txt
19+OutputBaseFilename=setup
20+Compression=lzma
21+SolidCompression=yes
22+ChangesEnvironment=yes
23+
24+[Tasks]
25+Name: modifypath; Description: Add application directory to your system path
26+
27+[Code]
28+function ModPathDir(): TArrayOfString;
29+var
30+ Dir: TArrayOfString;
31+begin
32+ setArrayLength(Dir, 1)
33+ Dir[0] := ExpandConstant('{app}');
34+ Result := Dir;
35+end;
36+#include "modpath.iss"
37+
38+[Languages]
39+Name: "english"; MessagesFile: "compiler:Default.isl"
40+Name: "basque"; MessagesFile: "compiler:Languages\Basque.isl"
41+Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
42+Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
43+Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
44+Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
45+Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
46+Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
47+Name: "french"; MessagesFile: "compiler:Languages\French.isl"
48+Name: "german"; MessagesFile: "compiler:Languages\German.isl"
49+Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
50+Name: "hungarian"; MessagesFile: "compiler:Languages\Hungarian.isl"
51+Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
52+Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
53+Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
54+Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
55+Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
56+Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
57+Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
58+Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
59+
60+[Files]
61+Source: "..\dist\build\pandoc\pandoc.exe"; DestDir: "{app}"; Flags: ignoreversion
62+Source: "..\README.html"; DestDir: "{app}"; Flags: ignoreversion
63+Source: "..\COPYRIGHT.txt"; DestDir: "{app}"; Flags: ignoreversion
64+Source: "..\COPYING.txt"; DestDir: "{app}"; Flags: ignoreversion
65+; NOTE: Don't use "Flags: ignoreversion" on any shared system files
66+
67+[Icons]
68+Name: "{group}\{cm:UninstallProgram,Pandoc}"; Filename: "{uninstallexe}"
69+Name: "{group}\Pandoc User's Guide"; Filename: "{app}\README.html"
70+