PDA

View Full Version : Exit if run from UNC Path


GalacTek
09-08-2005, 12:39 PM
Does anyone already have the code to stop the installer if it was run from a unc path. I need all of our installers to only run from a drive letter.

Brett
09-08-2005, 03:12 PM
What about checking the value of _SourceFolder or even _SourceDrive?

Eagle
09-08-2005, 07:10 PM
Along the lines of Brett's suggestion - here's a bit of code.

place the function in Global Functions if you wish
and call it from the 'On Startup' actions.

function IsFixedDrive()
local tDrvs = Drive.Enumerate();
bFixed_drv = false;
local D_verify = String.Mid(_SourceFolder, 1, 3);
for n, drv in tDrvs do
if (Drive.GetType(drv) == 3) then --fixed only
if (String.CompareNoCase(drv, D_verify) == 0) then
Dialog.Message("Confirmed Fixed Drive", drv); --delete
bFixed_drv = true;
break;
end
end
end
return bFixed_drv;
end

--to call it
if (not IsFixedDrive()) then
Application.Exit(0); --change to suit
end


HTH

GalacTek
09-09-2005, 08:13 AM
You guys Rock ! thanks worked great...