cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
BenjaminWilliam
Level 3

Writing Files to Users\Public

Another title could be (I need a DATADIR that is similar to TARGETDIR).

We have some .mdb and other files that we reformat durning app-run, according to Vista we need to have those files in \Users\Public\[Company]\[Product]. I have the following code stubbed out:

if (SYSINFO.WINNT.bWinVista) then
szPath= TARGETDISK + "\\Users\\Public\\" + IFX_COMPANY_NAME + "\\" + IFX_PRODUCT_NAME;
else
szPath = TARGETDIR;
endif;

I have a dialog for the User to change this value (if desired) using SdAskDestPath2 so the value of szPath could change. What can I replace szPath with so I can write those files in that location (Organization-Setup Design-Component-Destination)?

Thanks.
Labels (1)
0 Kudos
(4) Replies
BenjaminWilliam
Level 3

Ok, found that I can "Browse for Directory" in Organization-Setup Design-Component-Destination, then under "Script-defined Folders" create a "DATADIR" destination.

This then changes my if block to:
if (SYSINFO.WINNT.bWinVista) then
szPath = TARGETDISK + "\\Users\\Public\\" + IFX_COMPANY_NAME + "\\" + IFX_PRODUCT_NAME;
else
szPath = TARGETDIR;
endif;
FeatureSetTarget(MEDIA, "", szPath);

and my dialog to:
szDir = szPath;
if (nSetupType = CUSTOM) then
nResult = SdAskDestPath2( szTitle, szMsg, szDir );
FeatureSetTarget(MEDIA, "", szDir);

However I cannot "get" the value of DATADIR anywhere else because of compiler errors. But no harm because I can use it in functions such as:
RegDBSetKeyValueEx (szRegKey, "Data Path", REGDB_STRING, "",-1);

I just can't do:
szDir = ""
Which is unfortunate.
0 Kudos
rusgrafx
Level 4

Ben,

You just have to drop the quotes and < > from your assignment, like this...

szDir = DATADIR;
0 Kudos
BenjaminWilliam
Level 3

When I use:
szDir = DATADIR;

I get the following errors during Compile:
error C8025: 'DATADIR' : undefined identifier
error C8039: string value required

My if block is above this assignment call so it has a value. DATADIR doesn't turn blue like TARGETDIR does, so I don't know what I'm missing.
Thanks for your reply.
0 Kudos
Not applicable

BenjaminWilliam wrote:
When I use:
szDir = DATADIR;

I get the following errors during Compile:
error C8025: 'DATADIR' : undefined identifier
error C8039: string value required

My if block is above this assignment call so it has a value. DATADIR doesn't turn blue like TARGETDIR does, so I don't know what I'm missing.
Thanks for your reply.


DATADIR is not an InstallScript defined variable, so it wouldn't get highlighted like TARGETDIR would.

I think DATADIR would be a Script Defined Variable in most cases. You may want to review the help topic titled, "Adding a ScriptDefinedVar Property to Your Object " for more information on these types of variables.
0 Kudos