This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Getting CopyFile() function to actually copy
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Aug 06, 2009
02:28 PM
Getting CopyFile() function to actually copy
Hi -
I'm a newbie to IS 2010. I'm trying to copy a file using a CA in a Basic MSI project, however I'm not able to get it work. The file to be copied exists. Below is the snippet....
The condition checks seem to be happening fine since it throws the "folder does not exist" and the "unable to copy" msgs. Also I've set this CA for Immediate Execution and to occur after InstallFinalize in the exec sequence. What am I doing wrong? Any help is appreciated.
Thanks,
SK
I'm a newbie to IS 2010. I'm trying to copy a file using a CA in a Basic MSI project, however I'm not able to get it work. The file to be copied exists. Below is the snippet....
#define SRC_DIR "C:\\MVLK"
function Fn_CmnAppDataDir(hMSI)
BOOL bRESULT;
begin
if (ExistsDir ("CommonAppDataFolder\\MVLK\\data") != EXISTS) then
MessageBox ("Folder " + CommonAppDataFolder + "\\MVLK\\data does not exist.", INFORMATION);
bRESULT = CopyFile(SRC_DIR ^ "conf.txt", CommonAppDataFolder\\MVLK\\data ^ "conf.txt");
if (bRESULT) then
MessageBox ("File copied successfully", INFORMATION);
else
MessageBox ("Unable to copy file", WARNING);
endif;
endif;
end
The condition checks seem to be happening fine since it throws the "folder does not exist" and the "unable to copy" msgs. Also I've set this CA for Immediate Execution and to occur after InstallFinalize in the exec sequence. What am I doing wrong? Any help is appreciated.
Thanks,
SK
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Aug 06, 2009
06:59 PM
Your use of CommonAppDataFolder is inconsistent. Inside a quoted string, its value is just the string "CommonAppDataFolder", while used just by itself, its value is the corresponding folder name on the users' systems.
You've got it right in your MessageBox, but not in the other two places.
Try:
You've got it right in your MessageBox, but not in the other two places.
Try:
#define SRC_DIR "C:\\MVLK"
function Fn_CmnAppDataDir(hMSI)
BOOL bRESULT;
begin
if (ExistsDir (CommonAppDataFolder ^ "MVLK\\data") != EXISTS) then
MessageBox ("Folder " + CommonAppDataFolder + "\\MVLK\\data does not exist.", INFORMATION);
bRESULT = CopyFile(SRC_DIR ^ "conf.txt", CommonAppDataFolder ^ "MVLK\\data\\conf.txt");
if (bRESULT) then
MessageBox ("File copied successfully", INFORMATION);
else
MessageBox ("Unable to copy file", WARNING);
endif;
endif;
end;
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)