Go Back   FileForums > Game Backup > PC Games > PC Games - CD/DVD Conversions > Conversion Tutorials

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #28  
Old 15-11-2021, 06:40
Cesar82's Avatar
Cesar82 Cesar82 is offline
Registered User
 
Join Date: May 2011
Location: Brazil
Posts: 799
Thanks: 1,309
Thanked 1,702 Times in 580 Posts
Cesar82 is on a distinguished road
Quote:
Originally Posted by BYRedex View Post
Hi all.
Could you please help me with the following:
I have an installer for a mod, but if a person uninstalls a mod, the whole game is uninstalled as well.
How can I make it so that only the mod files are deleted?

I was thinking of keeping an install log and taking files from it to delete, but damn, that doesn't work right.
(It doesn't delete files from the list and it doesn't log small files)
I'll attach a sample code)

Thank you in advance.

Code:
Function InitializeUninstall(): Boolean;
begin
  ULog := FileExists(ExpandConstant('{app}\INSTALL.LOG')); // you need to get the log now, it might not exist later
  if ULog then // if there is a log file, create a sheet where we load the list of files
  begin
    unins_list := TStringList.Create;
    unins_list.LoadFromFile(ExpandConstant('{app}\INSTALL.LOG'));
  end;
  Result := True;
end;

Procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
  var
    i : Integer;
begin
  If CurUninstallStep = usPostUninstall then
    if ULog then
    begin
      for i := 0 to unins_list.Count-1 do DeleteFile(unins_list:[i]); // delete files from the list - It doesn't work
      unins_list.Free;
    end;
end;
Example here
The IsDone callback function (ProgressCallback) does not display the names of all files.
This function is called 4 times per second and only the current filename is shown in the output.

If you use a native installation of Inno Setup (No UnArc/ISDone) it will only remove the installed files.

But for you to continue using your script you can create a list using FindFirst and FindNext of all the files that are in the game folder right after the ISDoneInit function.
After the ISDoneStop function you do a new check using FindFirst and FindNext and compare the names with the previous list using:
if oldfileslist.IndexOf(<fullfilename>) < 0 then ins_log.Append(<fullfilename>);
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
INNO TROUBLESHOOT - Tutorials and Answers about INNO Setup REV0 Conversion Tutorials 129 21-05-2021 05:51
INNO TUTORIAL - Using Unicode and ANSI Versions of INNO Setup REV0 Conversion Tutorials 51 26-03-2015 06:57
Frequently Asked Questions Joe Forster/STA PC Games - Frequently Asked Questions 0 29-11-2005 09:48



All times are GMT -7. The time now is 15:55.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Copyright 2000-2020, FileForums @ https://fileforums.com