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: Copy files into D drive or C drive based on availability of D drive.
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
Sep 12, 2013
02:57 AM
Copy files into D drive or C drive based on availability of D drive.
Our Requirment:
1. Check if 😧 drive is present or not.
2. If present, then copy files into D:\Folder1 or else into C:\Folder1
I tried copying files using Files & Folders section. But there was no way over there to acheive the desired conditional copying.
Thanks,
Pavan
1. Check if 😧 drive is present or not.
2. If present, then copy files into D:\Folder1 or else into C:\Folder1
I tried copying files using Files & Folders section. But there was no way over there to acheive the desired conditional copying.
Thanks,
Pavan
- Tags:
- files and folders
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Sep 16, 2013
09:07 AM
PavanKumar1234 wrote:
Our Requirment:
1. Check if 😧 drive is present or not.
2. If present, then copy files into D:\Folder1 or else into C:\Folder1
I tried copying files using Files & Folders section. But there was no way over there to acheive the desired conditional copying.
Thanks,
Pavan
Go to the direct editor Directory table and add a folder for something like "CUSTOMVOLUME" and set the Directory_Parent to WindowsVolume as the default value.
You will need to check for a valid disk that is static, so you'll want a function to verify that there is a static D drive available, something like -
prototype BOOL IsValidDisk(HWND, STRING);
function BOOL IsValidDisk(hMSI, sDisk)
STRING sTestVolume;
BOOL isValid;
NUMBER nResult;
begin
try
isValid = FALSE;
sTestVolume = sDisk + ":";
if (GetSystemInfo (DRIVE, nResult, sTestVolume) >= 0) then
//IS_FIXED = 4, IS_CDROM = 6
if (nResult = IS_FIXED) then //Dirve is fixed
isValid = TRUE;
endif;
endif;
return isValid;
catch
endcatch;
end;
You'll need a method to check and set the disk, something like -
export prototype SetCustomDir(HWND);
function SetCustomDir(hMSI)
begin
//Disk is WindowsVolume by default,
//but if available, switch to D:\
if IsValidDisk(hMSI, "D:") then
MsiSetTargetPath(hMSI, "CUSTOMVOLUME", "D:\\");
endif;
end;
Any component with a root value of [CUSTOMVOLUME] will get the path you set in your custom action. You can set the InstallDir in your general properties to have a value of [CUSTOMVOLUME] if you wish, which will send everything to that drive. (Note that when you switch the InstallDir to [CUSTOMVOLUME] and click away from it, it will show WindowsVolume, indicating that the value equates to the default WindowsVolume, but this will change when the custom action runs if a static 😧 drive is available.
One final thing, schedule your customer to run at the appropriate time -
In the UI Sequence, run it early after CostFinalize
In the Execute sequence, After InstallValidate (condition: REMOVE <> "ALL")
Immediate Execution, Execute Only Once