My procedure reads folders names from an source location. And creates an eponymous folder in the destination. Folders every time is different that is why I can't create folders in [Dirs]
section. I don't know what names will be there. After that folders must be replaced with symlinks.
But I want the newly created folders (symlinks) to be uninstallable. How I can "register" this folder paths for later uninstall?
Here is my procedure
procedure CreateSymForPath(sor_pth: string; des_pth: string; isfolder: Boolean);
var
FindRec: TFindRec;
RootPath: string;
Path: string;
LinkNfo: SYMLINK_INFO;
begin
RootPath := ExpandConstant(sor_pth);
if FindFirst(RootPath + '\*', FindRec) then
begin
repeat
if ((FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY) <> 0) and
(FindRec.Name <> '.') and
(FindRec.Name <> '..') then
begin
Path := RootPath + '\' + FindRec.Name;
CreateDir(ExpandConstant(des_pth +FindRec.Name));
Log(ExpandConstant(des_pth + '\' + FindRec.Name));
Log(ExpandConstant('{src}' + '\' + sor_pth + FindRec.Name));
LinkNfo.name := ExpandConstant(des_pth + '\' + FindRec.Name);
LinkNfo.target := ExpandConstant('{src}' + '\' + sor_pth + FindRec.Name);
LinkNfo.create_dir := isfolder;
LinkNfo.relative := false;
ReplaceWithSymlink(LinkNfo)
end;
until not FindNext(FindRec);
end;
end;
I tried to create a function in the [dirs] section that will recursively return paths, but I have no experience.
Inno Setup does not have an API for "registering to uninstall". If you create something programmatically, you need to uninstall it programmatically too.
Use uninstaller event function CurUninstallStepChanged
.