I am string to convert a string to a constant as the StringChangeEx
function takes the second argument as a const but i have it as a string and am unsure how to get this function working as i am new to pascal.
The problem is in the BackupFile function when calling the StringChangeEx
function.
#define Name "Misery Mod"
#define Description "Misery Mod Installer"
#define Version "2.0"
#define Author "Misery Mod Development Team"
#define Website "http://miserymod.com"
#define Support "support@miserymod.com"
#define Copyright "Copyright [c] 2013 Misery Mod. All Rights Reserved."
#define Executable "Stalker-COP.exe"
[Setup]
AppId={{6423E48F-04F4-4E99-9420-FDD9165A6A90}
AppName={#Name}
AppVersion={#Version}
AppVerName={#Name} {#Version}
AppPublisher={#Author}
AppPublisherURL={#Website}
AppSupportURL={#Website}
AppUpdatesURL={#Website}
AppContact={#Support}
AppComments={#Description}
AppCopyright={#Copyright}
DefaultDirName={code:DetectIP}
DirExistsWarning=no
OutputDir=debug
OutputBaseFilename=mm2-installer
Compression=lzma2/ultra64
SolidCompression=yes
InternalCompressLevel=ultra
CompressionThreads=2
VersionInfoVersion={#Version}
VersionInfoCompany={#Author}
VersionInfoDescription={#Description}
VersionInfoTextVersion={#Name} {#Version}
VersionInfoCopyright={#Copyright}
VersionInfoProductName={#Name}
VersionInfoProductVersion={#Version}
VersionInfoProductTextVersion={#Name} {#Version}
DiskSpanning=True
DiskSliceSize=1566000000
SlicesPerDisk=1
MinVersion=0,5.01
SetupIconFile=C:\Users\Nathaniel\Desktop\MM2\mm2.ico
UninstallDisplayIcon={uninstallexe}
ShowTasksTreeLines=True
AlwaysShowGroupOnReadyPage=True
AlwaysShowDirOnReadyPage=True
LicenseFile=C:\Users\Nathaniel\Desktop\MM2\agreement.rtf
WizardImageFile=C:\Users\Nathaniel\Desktop\MM2\mm2-sidebar.bmp
WizardSmallImageFile=C:\Users\Nathaniel\Desktop\MM2\mm2-header.bmp
AllowCancelDuringInstall=False
DisableProgramGroupPage=yes
UninstallDisplayName={#Name}
[Run]
Filename: {app}\{#Executable}; Description: {cm:LaunchProgram, {#Name}}; Flags: nowait postinstall skipifsilent unchecked
Filename: {#Website}; Description: {cm:VisitWebsite, {#Name}}; Flags: nowait shellexec postinstall skipifsilent unchecked
[CustomMessages]
LaunchProgram=Enter the Wasteland.
VisitWebsite=Visit {#Website}.
[Languages]
Name: "English"; MessagesFile: "compiler:Default.isl"
Name: "Ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"
[Dirs]
Name: "{app}\_mm2"
[Files]
Source: "C:\Users\Nathaniel\Misery Mod v2.0\gamedata\anims\*"; DestDir: {app}; Flags: ignoreversion createallsubdirs recursesubdirs; BeforeInstall: BackupFile
[Code]
var Base:String;
var Backup:String;
function DetectIP(Path:String): string;
var Steam:String;
var Retail:String;
Begin
Base:=ExpandConstant('{pf}')+'\';
Steam:=ExpandConstant('{pf}')+'\Steam\SteamApps\common\Stalker Call of Pripyat';
Retail:=ExpandConstant('{pf}')+'\Steam\SteamApps\common\Stalker Call of Pripyat';
Begin
if DirExists(Steam) then
Base:=Steam;
End;
Begin
if DirExists(Retail) then
Base:=Retail;
End;
Result:=Base;
End;
procedure BackupFile();
var Folder:String;
var File:String;
Begin
Folder:=ExpandConstant(ExtractFilePath(CurrentFileName));
File:=ExpandConstant(CurrentFileName);
Backup:=StringChangeEx(Folder, Base, Base+'_mm2\', False);
MsgBox(Folder, mbInformation, MB_OK);
Begin
if not DirExists(Backup) then
CreateDir(Backup);
End;
End;
Any help would be great as i am trying to build a better installer for everyone's favorite S.T.A.L.K.E.R mod.