ddat interop with dat js cable interop with cabal js ddat's frontend = dat-thang cable fe = cable-thang dillo support based on cel's dillo-dat bootstrap node xplatform support Signed-off-by: divo <418@cryspace.space>
150 lines
4.7 KiB
Plaintext
150 lines
4.7 KiB
Plaintext
#define AppName "dat-thang"
|
|
#ifndef AppVersion
|
|
#define AppVersion "0.0.002"
|
|
#endif
|
|
#define AppPublisher "dat-gpt contributors"
|
|
#define AppExeName "dat-thang.exe"
|
|
|
|
[Setup]
|
|
AppId={{D1E521E5-19F8-4D7C-9C44-23B19D070A73}
|
|
AppName={#AppName}
|
|
AppVersion={#AppVersion}
|
|
AppPublisher={#AppPublisher}
|
|
DefaultDirName={autopf}\dat-thang
|
|
DefaultGroupName=dat-thang
|
|
DisableProgramGroupPage=no
|
|
PrivilegesRequired=lowest
|
|
PrivilegesRequiredOverridesAllowed=dialog
|
|
ArchitecturesAllowed=x64
|
|
ArchitecturesInstallIn64BitMode=x64
|
|
WizardStyle=modern
|
|
WizardResizable=yes
|
|
SetupIconFile=assets\dat-thang.ico
|
|
UninstallDisplayIcon={app}\dat-thang.exe
|
|
OutputDir=dist\installers
|
|
OutputBaseFilename=dat-thang-setup-{#AppVersion}-x64
|
|
Compression=lzma2
|
|
SolidCompression=yes
|
|
ChangesEnvironment=yes
|
|
CloseApplications=yes
|
|
RestartApplications=no
|
|
Uninstallable=yes
|
|
VersionInfoVersion={#AppVersion}.0
|
|
VersionInfoProductName=dat-thang
|
|
VersionInfoDescription=dat-thang v{#AppVersion} (prototype, pre-alpha)
|
|
|
|
[Languages]
|
|
Name: "english"; MessagesFile: "compiler:Default.isl"
|
|
|
|
[Tasks]
|
|
Name: "desktopicon"; Description: "Create a desktop shortcut for dat-thang"; GroupDescription: "Additional shortcuts:"; Flags: unchecked
|
|
Name: "addtopath"; Description: "Add dat-gpt terminal commands to PATH"; GroupDescription: "Terminal integration:"; Flags: unchecked
|
|
Name: "launch"; Description: "Launch dat-thang when setup finishes"; GroupDescription: "Finishing up:"; Flags: unchecked
|
|
|
|
[Files]
|
|
Source: "dist\windows-x64\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
|
Source: "assets\dat-shell.cmd"; DestDir: "{app}"; Flags: ignoreversion
|
|
Source: "assets\dat-thang.ico"; DestDir: "{app}"; Flags: ignoreversion
|
|
|
|
[Icons]
|
|
Name: "{group}\dat-thang"; Filename: "{app}\dat-thang.exe"; WorkingDir: "{userdocs}"; IconFilename: "{app}\dat-thang.exe"
|
|
Name: "{group}\dat-gpt command prompt"; Filename: "{cmd}"; Parameters: "/K ""{app}\dat-shell.cmd"""; WorkingDir: "{userdocs}"; IconFilename: "{app}\dat-thang.exe"
|
|
Name: "{group}\Windows build and bridge notes"; Filename: "{app}\docs\windows-build.md"
|
|
Name: "{autodesktop}\dat-thang"; Filename: "{app}\dat-thang.exe"; WorkingDir: "{userdocs}"; IconFilename: "{app}\dat-thang.exe"; Tasks: desktopicon
|
|
|
|
[Run]
|
|
Filename: "{app}\dat-thang.exe"; Description: "Launch dat-thang"; Flags: postinstall nowait skipifsilent; Tasks: launch
|
|
|
|
[Code]
|
|
const
|
|
EnvironmentKey = 'Environment';
|
|
PathValueName = 'Path';
|
|
|
|
function PathRegistryRoot(): Integer;
|
|
begin
|
|
if IsAdminInstallMode then
|
|
Result := HKEY_LOCAL_MACHINE
|
|
else
|
|
Result := HKEY_CURRENT_USER;
|
|
end;
|
|
|
|
function PathContainsEntry(const PathValue, Entry: String): Boolean;
|
|
var
|
|
Parts: TArrayOfString;
|
|
I: Integer;
|
|
begin
|
|
Result := False;
|
|
Parts := SplitString(PathValue, ';');
|
|
for I := 0 to GetArrayLength(Parts) - 1 do
|
|
if CompareText(Trim(Parts[I]), Entry) = 0 then
|
|
begin
|
|
Result := True;
|
|
Exit;
|
|
end;
|
|
end;
|
|
|
|
procedure AddInstallPath;
|
|
var
|
|
Root: Integer;
|
|
PathValue, Entry: String;
|
|
begin
|
|
Root := PathRegistryRoot();
|
|
Entry := ExpandConstant('{app}');
|
|
if not RegQueryStringValue(Root, EnvironmentKey, PathValueName, PathValue) then
|
|
PathValue := '';
|
|
if not PathContainsEntry(PathValue, Entry) then
|
|
begin
|
|
if PathValue <> '' then
|
|
PathValue := PathValue + ';';
|
|
PathValue := PathValue + Entry;
|
|
RegWriteExpandStringValue(Root, EnvironmentKey, PathValueName, PathValue);
|
|
RegWriteStringValue(Root, 'Software\dat-gpt\Installer', 'AddedDatPath', Entry);
|
|
end;
|
|
end;
|
|
|
|
procedure RemoveInstallPath;
|
|
var
|
|
Root: Integer;
|
|
PathValue, Entry, NewPath, AddedEntry: String;
|
|
Parts: TArrayOfString;
|
|
I: Integer;
|
|
begin
|
|
Root := PathRegistryRoot();
|
|
Entry := ExpandConstant('{app}');
|
|
if not RegQueryStringValue(Root, 'Software\dat-gpt\Installer', 'AddedDatPath', AddedEntry) then
|
|
Exit;
|
|
if CompareText(AddedEntry, Entry) <> 0 then
|
|
Exit;
|
|
if not RegQueryStringValue(Root, EnvironmentKey, PathValueName, PathValue) then
|
|
Exit;
|
|
Parts := SplitString(PathValue, ';');
|
|
NewPath := '';
|
|
for I := 0 to GetArrayLength(Parts) - 1 do
|
|
if (Trim(Parts[I]) <> '') and (CompareText(Trim(Parts[I]), Entry) <> 0) then
|
|
begin
|
|
if NewPath <> '' then
|
|
NewPath := NewPath + ';';
|
|
NewPath := NewPath + Trim(Parts[I]);
|
|
end;
|
|
if NewPath <> PathValue then
|
|
begin
|
|
if NewPath = '' then
|
|
RegDeleteValue(Root, EnvironmentKey, PathValueName)
|
|
else
|
|
RegWriteExpandStringValue(Root, EnvironmentKey, PathValueName, NewPath);
|
|
end;
|
|
RegDeleteValue(Root, 'Software\dat-gpt\Installer', 'AddedDatPath');
|
|
end;
|
|
|
|
procedure CurStepChanged(CurStep: TSetupStep);
|
|
begin
|
|
if (CurStep = ssPostInstall) and WizardIsTaskSelected('addtopath') then
|
|
AddInstallPath();
|
|
end;
|
|
|
|
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
|
begin
|
|
if CurUninstallStep = usUninstall then
|
|
RemoveInstallPath();
|
|
end;
|