Page 1 of 1

File access for newly created directory

Posted: Wed Aug 08, 2012 1:03 pm
by donovanh
I have a feeling I may be overlooking something obvious (I freely acknowledge being a novice at this), but I seem to be missing something about creating directories and granting access to them.

I'm using the Developer version of IA. I added the System - Application Directory folder (with common folder checkbox) in the Files and Settings pages, then added a subdirectory to that for my application. In the MSIcode view, I can then see then line that creates the desired folder. But what I'm missing is how to grant access to that directory to all users so the UAC restrictions don't wreck everything during program execution. (I want to store a license file there that will be found no matter which user is working.)

I tried dragging a Set Access Control command into the window after the Apply Install line that is right after the Create Folder command (is that the right place?). When I try to tell it what folder to work with, though, I can't figure out how to tell it the subdirectory I just made. I click on $ALLAPPDATA in the pane on the left of the Set Access Control dialog box, and it doesn't show the subdirectory I added back in the Files and Settings design page, leaving me stuck.

If someone could explain in newbie terms exactly how to grant everyone access to the subfolder I've created, I'd be very grateful.

Respectfully,
Donovan

Re: File access for newly created directory

Posted: Thu Aug 09, 2012 8:03 am
by FrancescoT
Dear Donovanh,

I'm not quite sure if you are creating the folder after Apply Install ( ... but it seems to me in that way).
If true, you must remember that Create Folder is a Windows Installer command and if executed just after Apply Install, it will fails.
Windows installer commands (purple command) are not executed immediately but their execution is deferred to Apply Install execution.

So if your folder creation is part of your setup flow, the Create Folder command should be placed before an Apply Install call.

Anyway if you want to execute the command after and imediatelly, place it inside a NATIVE ENGINE ON/OFF switch.
For more details on NATIVE ENGINE please refer to InstallAware documentation.

Finally, below is an example (using IA clipbord data format) on how to create a folder immediately and how to grant permission to USER group.

Code: Select all

~InstallAware Clipboard Data~
~Set Access Control~
~{3B1CE278-C4EC-4459-B257-E99CFE43A194}~
~$MYPATH$~
~FALSE~
~FALSE~
~FALSE~
~TRUE~
~Users~
~TRUE~
~TRUE~
~TRUE~
~FALSE~
~FALSE~
~TRUE~
~FALSE~
~FALSE~
~FALSE~
~FALSE~
~Comment~
~{2A11BF47-F41D-47B2-B1D4-A94EE2D99383}~
~~
~Set Variable~
~{062E9C59-6B7B-4BCE-AA72-7A25F686EC06}~
~NATIVE_ENGINE$MYAH$MYAH$FALSE~
~FALSE~
~Create Folder~
~{419E480C-BB9C-41D7-8046-2503E19B44E2}~
~$MYPATH$~
~Set Variable~
~{59B8CADE-CCA6-454F-BA27-FF3B7EBC2532}~
~NATIVE_ENGINE$MYAH$MYAH$FALSE~
~TRUE~
~Comment~
~{6C4FD4AB-9758-4DBB-8119-949ADC605FD1}~
~~
~Set Variable~
~{5C818743-0D8B-41A7-B8ED-3A118011CE1A}~
~MYPATH$MYAH$MYAH$FALSE~
~C:\test~
the same as human readable format:

Code: Select all

Set Variable MYPATH to C:\test
 
Set Variable NATIVE_ENGINE to TRUE
Create Folder $MYPATH$
Set Variable NATIVE_ENGINE to FALSE
 
Set Read Write Permissions on File System Object "$MYPATH$" for Users
Hope this helps you.

Regards