; Script generated by the My Inno Setup Extensions Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
AppName=P4-Journal: Perforce Checkpoint and Journal parsing tool
AppVerName=P4-Journal (2007.3.136157)
AppPublisher=Perforce Software <support@perforce.com>
AppPublisherURL=http://www.perforce.com
AppCopyright=Copyright 2001-2007 Perforce Software Inc.
WindowVisible=yes
AppSupportURL=http://www.perforce.com
DefaultDirName={code:P4JLibDir}
DisableProgramGroupPage=yes
DirExistsWarning=no
DisableDirPage=yes
SourceDir=.
OutputDir=.
OutputBaseFilename=p4journal-setup
[Files]
Source: "blib\lib\P4\Journal.pm"; DestDir: "{code:P4JLibDir}"; Flags: overwritereadonly;
Source: "blib\lib\P4\Journal\Subs.pm"; DestDir: "{code:P4JSLibDir}"; Flags: overwritereadonly;
Source: "blib\arch\auto\P4\Journal\Journal.dll"; DestDir: "{code:P4JArchDir}"; Flags: overwritereadonly;
Source: "blib\arch\auto\P4\Journal\Journal.lib"; DestDir: "{code:P4JArchDir}"; Flags: overwritereadonly;
Source: "blib\arch\auto\P4\Journal\Journal.exp"; DestDir: "{code:P4JArchDir}"; Flags: overwritereadonly;
Source: "blib\arch\auto\P4\Journal\Journal.bs"; DestDir: "{code:P4JArchDir}"; Flags: overwritereadonly;
Source: "blib\lib\auto\P4\Journal\autosplit.ix"; DestDir: "{code:P4JArchDir}"; Flags: overwritereadonly;
[Code]
// This section is the Pascal script - various procedures called from above.
program Setup;
var
SiteLibPath: String;
//---------------------------------------------------
// Called automatically at the start of initialization
function InitializeSetup(): Boolean;
var
TempFile: String;
Cmd: String;
Lines: TArrayOfString;
i: Longint;
ResultCode: Integer;
begin
// Make sure Perl is installed and work out where to copy library
Result := false;
TempFile := GenerateUniqueName(GetTempDir(), '.ini');
TempFile := 'C:\install.txt';
//
// Some fiddling to find appropriate way to get output - straight piping didn't seem to work.
// We use Perl's Config.pm module to figure out where to put the files.
//
// Note: use qq() to do single quotes inside the Pascal quotes. It also saves us
// having to escape the \'s in the file path as well as saving us from horrible
// multiple quotes (e.g. '''' )
//
Cmd := '"use Config; ';
Cmd := Cmd + 'open( FH, q(>' + TempFile + ')) or die( qq(Failed to write temp file));';
Cmd := Cmd + 'print( FH qq(SiteLib=), $Config{ qq(sitelib) }, qq(\n) );';
Cmd := Cmd + 'close( FH );';
Cmd := Cmd + '"';
Cmd := '-e ' + Cmd;
if not Exec('perl.exe', Cmd, GetTempDir(), SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
MsgBox('Can''t find perl.exe in your path - Perl doesn''t seem to be installed.' + #13#13 'Please fix this and try again!',
mbError, MB_OK);
end else begin
if not LoadStringsFromFile(TempFile, Lines) then
begin
MsgBox('Error loading strings '' from file.', mbError, MB_OK);
end else begin
// Extract the SiteLib path from the file
for i := 0 to GetArrayLength( Lines ) - 1 do
begin
if ( Pos( 'SiteLib=', Lines[ i ] ) = 1 ) then
begin
SiteLibPath := Lines[ i ];
StringChange( SiteLibPath, 'SiteLib=', '' );
end;
end;
if ( Length( SiteLibPath ) > 0 ) then
begin
Result := true
end else begin
MsgBox('Unable to determine Perl sitelib directory', mbError, MB_OK);
end;
end;
//DeleteFile(TempFile);
end;
end;
//----------------------------
function P4JSLibDir(Default: String): String;
begin
Result := SiteLibPath + '\\P4\\Journal';
end;
function P4JLibDir(Default: String): String;
begin
Result := SiteLibPath + '\\P4';
end;
function P4JArchDir(Default: String): String;
begin
Result := SiteLibPath + '\\auto\\P4\\Journal';
end;
begin
end.