OverviewExamples
string VisualPatch.CheckFolderVersion ( |
-- Define a global variable that will indicate the name
-- of the installed version on the user's system. A nil value
-- indicates that an installed version has not been found.
g_InstalledVersion = nil;
-- Location method: Current folder
-- Check whether the software is installed in the folder
-- that the patch was run from.
if not g_InstalledVersion then
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", _SourceFolder);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", _SourceFolder);
end
end
Checks to see if the folder where the patch is running from (denoted by the global variable _SourceFolder) is found to be the application folder being searched for.
-- Location method: Registry key
-- Read a folder path from the Registry.
if not g_InstalledVersion then
local MainKey = HKEY_CURRENT_USER;
local SubKey = SessionVar.Expand("Software\\Your Company\\Your Product");
local ValueName = "InstallFolder";
local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", FolderPath);
end
end
Checks to see if the folder path read from a Registry key is found to be the application folder being searched for.
See also: Related Actions