cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
UNeverNo
Level 6

Installscript: Howto set targetdir for script-created features?

I need to install dynamically features depending on the data found in my sourcefolder, e.g. I have two folders apples and cherries:
SOURCE\apples
SOURCE\cherries

Now the user should be able to chose which feature he wants to install. Depending on his choice I want to transfer these folders to a certain folder each:
TARGET\1\apples
TARGET\2\1\cherries

I was able to add my script-features by using FeatureAddItem but now I need to bind a folder to that feature and set the targetdir. How do I do this?
I tried manipulating OnInstalling, but unfortunately the szFile is no byref-variable, which means I can't change the targetdir 😞
And if I use OnInstalled (to move the files) it would be a kind of "temp-folder which needs to be deleted in the end"-solution, which I don't like much.
Labels (1)
0 Kudos
(10) Replies
RobertDickau
Flexera Alumni

How are you actually transferring the files associated with the script-defined feature? Could you borrow FEATURE_FIELD_MISC or the like to store the fake destination location?
0 Kudos
UNeverNo
Level 6

Hi Robert,

they get transfered, because they are part of a feature/component which is not script-generated. I now set the targetdir to supportdir and copy my files to the real targetdir. But I somehow don't like it 😉

FEATURE_FIELD_MISC won't help, because I can't bind the folder "cherries" to that script-based feature and therefore the info in FEATURE_FIELD_MISC is useless.
0 Kudos
RobertDickau
Flexera Alumni

Sorry, I'm not sure how the real features/components and the script-defined features are connected? How are you copying files from SUPPORTDIR to the real TARGETDIR?
0 Kudos
UNeverNo
Level 6

There is a real feature and a real component, which has a dynamiclly linked folder.
During runtime I read an ini-file included in SRCDIR, which contains all modules. With these information I create these script-based features and show them to the user. Now he can select what he wants to install. But at this point I can bind a folder to the feature (a folder which is inside the mentioned component). If I could perform this, it would be possible to deaktivate the normal feature and just install the folders binded to the script-features.

But because this doesn't work, I need to copy each file in OnInstalled and delete then the TARGETDIR which pointed to a temp folder.

Hope that was a bit clearer 🙂
0 Kudos
RobertDickau
Flexera Alumni

Is it an option to use only script-defined features, and then use XCopyFile to copy the corresponding files directly from the source to the destination?
0 Kudos
UNeverNo
Level 6

That's what I do now. But I don't like it much, because I copy all files twice.
0 Kudos
RobertDickau
Flexera Alumni

I mean, is it an option to copy the files directly from the source to the target without the "real" feature and component?
0 Kudos
UNeverNo
Level 6

Yes, but how will I manage that? There will be no events if there is no real component containing my data. Or what do you have in mind? 🙂
0 Kudos
RobertDickau
Flexera Alumni

You should still be able to use events in general when doing file transfer with XCopyFile. (Not feature events, of course.) Was there something in particular you're unable to do?

Robert
0 Kudos
UNeverNo
Level 6

What events are you talking about? I can just go through my dialogs and after pressing "Install", waiting for the standard events to occur, or am I wrong :confused:
0 Kudos