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
- :
- Re: RenameFile to move folder to backup
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
Nov 27, 2019
03:49 PM
RenameFile to move folder to backup
This is driving me crazy, because I have other code in the same installer that works just fine when using RenameFile() to move folders and their contents (subfolders and files) to the backup folder. For some reason, this code doesn't work, and I have no idea why. I've tried creating the backup folder before the RenameFile() operation too, and the folder is created, but RenameFile() still doesn't work. In the following code, the messages for the "Base source path is " and "Base target path is " are displayed, and the paths are correct. Then I just get the message "Could not move [folder2] to [folder2]" because RenameFile() failed. Why?
//----------------------------
// Backup and restore Help
//----------------------------
function BackupRestoreHelp(BackupDir)
STRING SrcPath, TargetPath, HelpFiles;
begin
Disable(LOGGING);
if (!MAINTENANCE) then
SrcPath = TARGETDIR;
TargetPath = TARGETDIR ^ BackupDir;
elseif (REMOVEONLY || REMOVEALL) then
SrcPath = TARGETDIR ^ BackupDir;
TargetPath = TARGETDIR;
endif;
MessageBox("Base source path is " + SrcPath, INFORMATION);
MessageBox("Base target path is " + TargetPath, INFORMATION);
// Move the Help files
HelpFiles = "help\\AppHelp";
if (RenameFile(SrcPath ^ HelpFiles, TargetPath ^ HelpFiles) < 0) then
MessageBox("Could not move " + SrcPath ^ HelpFiles + " to " + TargetPath ^ HelpFiles, SEVERE);
abort;
endif;
Enable(LOGGING);
end;
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Nov 27, 2019
03:50 PM
To clarify, in the message "Could not move [folder2] to [folder2]", those paths are also correct.
