Page 1 of 1
Permanent install of folders
Posted: Mon Jun 05, 2006 1:09 pm
by scanner2001
Is there a way to permanently install folders that are setup in the installation? Our situation is we install a number of folders, about 20, with subfolders, but do not want to uninstall or remove any content if the software is uninstalled.
I thought about putting a "dummy" permanent file in lowest level of each folder, but that seems like a cludge. The other thought is to move the folder creation out of the region for install and update, but that looks like it removes the ability to use the interface for modifying the install. The third option, which I do not see anyway to do, is to put an "if" statement in front of the folder creation, so that if an uninstall is running, do not remove. I like the last option the best, but do not see how to do this.
Thanks,
Jeff
Posted: Tue Jun 06, 2006 9:30 am
by jimo
You may want to try using the Call DLL function and calling "CreateDirectoryA" in the Win32 API before any Install Files command, that way the folders exist before the windows installer engine creates them therefore they should not be removed on uninstall.
Calling dll
Posted: Tue Jun 06, 2006 9:57 am
by scanner2001
I have not been able to get the call dll function to work. I am using the following inputs:
dll path: C:\\WINNT\\system32\\Kernel32.dll (as well as just Kernel32.dll)
function name: CreateDirectoryA
type: pointer to string
value: c:\\test2
type: pointer to long
value: 0
I have tried a couple of different options, do you have any suggestions?
Thanks,
Jeff
Posted: Tue Jun 06, 2006 10:14 am
by jimo
Is your return type a BOOL?
If that fails and you really want the folders to be permanent write out batch file or windows script file that creates the directories for you and use Run Program.
The simplest solution is to install a 0 byte permanent file in each of the folders you want to make permanent.
permanent folders
Posted: Tue Jun 06, 2006 12:14 pm
by scanner2001
Yes, my return type is a bool. I have not been able to get the call dll to work for any dll's either.
I already did the 0 byte file in the folders to keep, and marked the files as permanent, that just seems like a really "hokey" solution.
Thanks for the input tho.
Posted: Tue Jun 06, 2006 12:21 pm
by jimo
I use the Call DLL functin quite extensively in my packages for deleting files and setting the current working directory with no problems, to venture a guess I would say that the problem with the CreateDirectoryA Win API call has to do with what is passed in SECURITY_ATTRIBUTES.
Posted: Tue Jun 06, 2006 3:20 pm
by MichaelNesmith
Try this:
Code: Select all
~InstallAware Clipboard Data~
~Call DLL Function~
~{EB5C7937-5FCC-44CA-964B-FCDA05E5206C}~
~kernel32.dll,CreateDirectoryA,bool,,"pointer to string",c:\\temp\\test,"double word",0,$~
~mIDEFunc.dll\\mEXEFunc.dll~
This creates c:\\temp\\test. For it to work, c:\\temp must exist (the API does not create folders "recursively").