This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- InstallScript - Devs added/removed file from Component Directory...
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Feb 10, 2014
04:07 PM
InstallScript - Devs added/removed file from Component Directory...
So the Devs removed some files and then added new ones, not named the same, and it was completely out of my hands...
This is the code for trying to update the current installation:
The Devs want to use the Component directory (dir that is dynamically linked to a Component) as a dumping ground for all current files. The code above allows me to get the new files installed but the old ones are still present and I need the gone. Originally I used FeatureSetupTypeSet(MEDIA, "Complete") followed by FeatureRemoveAllInLogOnly() which basically uninstalls the current installation instead of just remove the files that were installed previously, so that the new ones can be installed. So all in all I have to be able to remove the old files within the Component/Feature and install the new ones from the running installer, always in every case.
Assume Deleted file names: OldFile_01
Assume New file names: NewFile_01
Assume Feature name: Feature_01
Assume Component name: Comp_01
OldFile_01 is present in v1.1
NewFile_01 is not present in v1.1
NewFile_01 is present in v1.2
OldFile_01 is not present in v1.2
v1.1 is installed on the system and they want to upgrade to v1.2
OldFile_01 and NewFile_01 are in the same Feature/Component which pulls from the same directory (OldFile was deleted from said dir and NewFIle was added to the said dir)
When user upgrades OldFile_01 needs to be removed from the system and NewFile added, dynamically*.
When user reverts NewFile_01 needs to be removed from the system and OldFile_01 added, dynamically*.
*By "dynamically" I mean that the installer has NO knowledge of the change made pre-build...
tl;drThe Feature in questions contains only 1 Component that holds a large number of config files (sort of). I need to remove all files that are not present in the currently running installer and make sure to add any new files present in that running installer.
This is the code for trying to update the current installation:
function OnMoveData()
.
.
.
begin
.
.
.
//--- If we are updating...
elseif (DetermineIfUpgrade()) then
//--- Set the installation directory to the %ALLUSERSPROFILE%
TARGETDIR = GetCurrentTargetDirectory();
//--- Make sure to select any NEW features
FeatureSelectNew( MEDIA, TRUE );
FeatureReinstall();
//--- Set appropriate StatusEx static text.
Sprintf(sFormattedMsg, @IDS_STATICTEXT_MAINTUI_UPGRADE, @IDS_READABLE_VERSION_STRING);
SetStatusExStaticText(sFormattedMsg);
.
.
.
end
The Devs want to use the Component directory (dir that is dynamically linked to a Component) as a dumping ground for all current files. The code above allows me to get the new files installed but the old ones are still present and I need the gone. Originally I used FeatureSetupTypeSet(MEDIA, "Complete") followed by FeatureRemoveAllInLogOnly() which basically uninstalls the current installation instead of just remove the files that were installed previously, so that the new ones can be installed. So all in all I have to be able to remove the old files within the Component/Feature and install the new ones from the running installer, always in every case.
Assume Deleted file names: OldFile_01
Assume New file names: NewFile_01
Assume Feature name: Feature_01
Assume Component name: Comp_01
OldFile_01 is present in v1.1
NewFile_01 is not present in v1.1
NewFile_01 is present in v1.2
OldFile_01 is not present in v1.2
v1.1 is installed on the system and they want to upgrade to v1.2
OldFile_01 and NewFile_01 are in the same Feature/Component which pulls from the same directory (OldFile was deleted from said dir and NewFIle was added to the said dir)
When user upgrades OldFile_01 needs to be removed from the system and NewFile added, dynamically*.
When user reverts NewFile_01 needs to be removed from the system and OldFile_01 added, dynamically*.
*By "dynamically" I mean that the installer has NO knowledge of the change made pre-build...
tl;drThe Feature in questions contains only 1 Component that holds a large number of config files (sort of). I need to remove all files that are not present in the currently running installer and make sure to add any new files present in that running installer.
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Feb 12, 2014
09:59 AM
So I've sort of figured out a workaround... and sort encountered another problem.
Part of the issue is that I was using FeatureSelectNew( MEDIA, TRUE ) which only selects new features in the current running installer and then FeatureReinstall() which only plants the files from those already installed features to the system. This is why I had both the old deleted files and the new ones in the same installed directory.
Removed that and figured out that I need to unselect those already installed features in order to remove those installed files and place in the new ones.
I already had a method that came from bastardizing the OnMoveData() method into only uninstalling and handles nothing else. This is mostly so I could support installation logic in the spec... not a great idea but I needed it that way in order to bypass a few things...
So I ended up with this more or less:
So now my problem is that when I can FeatureRemoveAllInLogOnly() and then FeatureTransferData(MEDIA) it completely uninstalls the application even though I later call FeatureSetupTypeSet(MEDIA, "Complete") and then FeatureTransferData(MEDIA) again. By completely uninstall I mean that when I go to uninstall via Add/Remove, it gives me the error stating that it was already uninstalled.
ANY HELP IS APPRECIATED...
Part of the issue is that I was using FeatureSelectNew( MEDIA, TRUE ) which only selects new features in the current running installer and then FeatureReinstall() which only plants the files from those already installed features to the system. This is why I had both the old deleted files and the new ones in the same installed directory.
Removed that and figured out that I need to unselect those already installed features in order to remove those installed files and place in the new ones.
I already had a method that came from bastardizing the OnMoveData() method into only uninstalling and handles nothing else. This is mostly so I could support installation logic in the spec... not a great idea but I needed it that way in order to bypass a few things...
So I ended up with this more or less:
//--- Uninstall current version (if failed then abort installation)
if (!PerformActualUninstall()) then
abort;
endif;
//--- Select all current feature
FeatureSetupTypeSet(MEDIA, "Complete");
//--- Set up OS specific features
if(!PrepareInstallation()) then
MessageBox(@IDS_ERROR_PREPARE_INSTALLATION_MSG, SEVERE);
abort;
endif;
So now my problem is that when I can FeatureRemoveAllInLogOnly() and then FeatureTransferData(MEDIA) it completely uninstalls the application even though I later call FeatureSetupTypeSet(MEDIA, "Complete") and then FeatureTransferData(MEDIA) again. By completely uninstall I mean that when I go to uninstall via Add/Remove, it gives me the error stating that it was already uninstalled.
ANY HELP IS APPRECIATED...