cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
spiderlily
Occasional contributor

Uninstall does not remember global variable feature target

Jump to solution

I am writing an installer to install data to a different, user-defined location than the application code.  The "App Code" feature is being installed to TARGETDIR, and "App Data" is being installed to DATA_DIR. 

The dialogs, installation and uninstallation are working, almost.  The problem is at the end of the uninstall process (OnMaintUIAfter), I need to call my custom function RemoveEmptyFolders(/*string*/ path, /* bool */ removeRoot) which recursively deletes all empty folders from the data directory, including the root folder, if removeRoot = TRUE.   At this point, RemoveEmptyFolders() does not know DATA_DIR on uninstall, but it remembers TARGETDIR.

I declared DATA_DIR as a global STRING variable.  Data components are defined to install at <DATA_DIR>\whatever_subfolder, and they are associated with the "App Data" feature.  FeatureSetTarget("App Data",  "<DATA_DIR>", path) worked to get the feature and all its components to install to the correct place.

On uninstall, all files are successfully removed from both TARGETDIR and DATA_DIR.  However there are a bunch of empty folders left over inside the DATA_DIR folder.  So RemoveEmptyFolders() didn't work for that location.  It worked for TARGETDIR, so it's not the function itself.

Debug messages reveal that InstallShield has no idea what DATA_DIR is at uninstall time.  RemoveEmptyFolders() started trying to traverse paths I've never even seen before, that start with .\whateverfolder.  Yikes.  I put in a check to make sure the path != "", so at least it won't do that anymore.

How did InstallShield know where to uninstall the "App Data" files from?  How can I grab that path value at uninstall time, so I can pass it to my function and delete empty folders?  If the DATA_DIR value is not in the log, then what IS in the log that tells InstallShield where to uninstall the "App Data" files?

0 Kudos
1 Solution

Accepted Solutions
MarkusLatz
Intrepid explorer

Re: Uninstall does not remember global variable feature target

Jump to solution
2 Replies
MarkusLatz
Intrepid explorer

Re: Uninstall does not remember global variable feature target

Jump to solution
spiderlily
Occasional contributor

Re: Uninstall does not remember global variable feature target

Jump to solution

Yes, it does sound like the same problem.  I'll try TextSubSetValue and TextSubGetValue.  If that works, I'll mark your suggestion as the answer.  Thanks!

0 Kudos