I am patching an AMS6 project with three versions 1.0.0.2, 1.0.0.3, and 1.0.0.4. The destination folder indicated for the files is %AppFolder%\AutoPlay\Foldername.
When testing the patch, the patch files are being installed to %AppFolder%\AutoPlay\AutoPlay (the patch file is creating another AutoPlay folder within the first one). Of course, the patch files are not usable in that location or accessible via the menu.
Obviously I am missing something, but if I am specifying the destination as listed above, why is another AutoPlay folder being created by the patch?
Here's the Startup Code in VP:
I have also checked to make sure that I do not have a second AutoPlay folder embedded within the AMS6 build. Why would the patch file create a second, embedded AutoPlay folder...?
What am I missing?
When testing the patch, the patch files are being installed to %AppFolder%\AutoPlay\AutoPlay (the patch file is creating another AutoPlay folder within the first one). Of course, the patch files are not usable in that location or accessible via the menu.
Obviously I am missing something, but if I am specifying the destination as listed above, why is another AutoPlay folder being created by the patch?
Here's the Startup Code in VP:
--------------------------------------------------------------
-- Check for administrative privileges
--------------------------------------------------------------
-- Make sure that the user has administrative privileges on the system.
-- (g_IsUserAdmin is defined in _Global_Functions.lua)
if not g_IsUserAdmin() then
if not _SilentPatch then
local Title = SessionVar.Expand("%WindowTitle%");
local Message = SessionVar.Expand(VisualPatch.GetLocalizedString(" MSG_SYSREQ_ADMIN"));
local DlgResult = Dialog.Message(Title, Message, MB_OKCANCEL, MB_ICONEXCLAMATION);
if DlgResult == IDCANCEL then
Application.Exit(EXIT_REASON_USER_NOT_ADMIN);
end
else
-- Since it is a silent patch, fail
Application.Exit(EXIT_REASON_USER_NOT_ADMIN);
end
end
--------------------------------------------------------------
-- Locate installed version
--------------------------------------------------------------
-- 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
-- Location method: Registry key
-- Read a folder path from the Registry.
if not g_InstalledVersion then
local MainKey = HKEY_LOCAL_MACHINE;
local SubKey = SessionVar.Expand("SOFTWARE\\MYPROJECT\\");
local ValueName = "Location";
local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", FolderPath);
end
end
-- Location method: Current folder
-- Check whether the software is installed in the folder
-- that the patch was run from.
-- Remove the following block comment to enable this script
if not g_InstalledVersion then
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", _SourceFolder);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", _SourceFolder);
end
end
-- Location method: File search
-- Search the user's system for a file that is known to
-- exist in the software's application folder.
if not g_InstalledVersion then
local TargetFileName = "autorun.cdd";
local tbFolders = {};
tbFolders[1] = SessionVar.Expand("%ProgramFilesFolder%\\My Project");
tbFolders[2] = SessionVar.Expand("%ProgramFilesFolder%");
-- Insert other folders here...
local CheckFixedDrives = true;
local CheckNetworkDrives = false;
-- (g_FindApplicationOnSystem is defined in _Global_Functions.lua)
g_InstalledVersion = g_FindApplicationOnSystem("%AppFolder%", TargetFileName, tbFolders, CheckFixedDrives, CheckNetworkDrives);
end
--------------------------------------------------------------
-- Ensure that installed software is not running
--------------------------------------------------------------
-- If we located an out-of-date version, make sure the installed
-- software is not running.
-- Remove the following block comment to enable this script
if g_InstalledVersion then
local Filename = SessionVar.Expand("autorun.cdd");
local ProgramName = SessionVar.Expand("My Project");
-- (g_EnsureProgramIsClosed is defined in _Global_Functions.lua)
local ProgramIsClosed = g_EnsureProgramIsClosed(Filename, ProgramName);
if not ProgramIsClosed then
Application.Exit(EXIT_REASON_PROGRAM_IS_OPEN);
end
end
--------------------------------------------------------------
-- Set session variables
--------------------------------------------------------------
-- Set session variables that will be used in the log file
-- and in the user interface.
if g_InstalledVersion then
SessionVar.Set("%InstalledVersion%", g_InstalledVersion);
SessionVar.Set("%TargetVersion%", VisualPatch.GetTargetVersion());
end
--------------------------------------------------------------
-- Log result
--------------------------------------------------------------
-- Make a log file entry with the result.
if g_InstalledVersion then
local LogMsg = SessionVar.Expand("Success\tLocated installed version %InstalledVersion%: %AppFolder%\r\n");
VisualPatch.WriteToLogFile(LogMsg);
else
local LogMsg = SessionVar.Expand("Error\tCould not locate software on system\r\n");
VisualPatch.WriteToLogFile(LogMsg);
end
--------------------------------------------------------------
-- Select start screen
--------------------------------------------------------------
-- Decide which "Before Patching" screen to show.
if g_InstalledVersion then
if g_InstalledVersion == VisualPatch.GetTargetVersion() then
-- The target version was found
Screen.SetStartScreen("Software is Current");
else
-- An out-of-date version was found
Screen.SetStartScreen("Ready to Patch");
end
else
-- No version was found
Screen.SetStartScreen("Cannot Locate Software");
end
-- Check for administrative privileges
--------------------------------------------------------------
-- Make sure that the user has administrative privileges on the system.
-- (g_IsUserAdmin is defined in _Global_Functions.lua)
if not g_IsUserAdmin() then
if not _SilentPatch then
local Title = SessionVar.Expand("%WindowTitle%");
local Message = SessionVar.Expand(VisualPatch.GetLocalizedString(" MSG_SYSREQ_ADMIN"));
local DlgResult = Dialog.Message(Title, Message, MB_OKCANCEL, MB_ICONEXCLAMATION);
if DlgResult == IDCANCEL then
Application.Exit(EXIT_REASON_USER_NOT_ADMIN);
end
else
-- Since it is a silent patch, fail
Application.Exit(EXIT_REASON_USER_NOT_ADMIN);
end
end
--------------------------------------------------------------
-- Locate installed version
--------------------------------------------------------------
-- 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
-- Location method: Registry key
-- Read a folder path from the Registry.
if not g_InstalledVersion then
local MainKey = HKEY_LOCAL_MACHINE;
local SubKey = SessionVar.Expand("SOFTWARE\\MYPROJECT\\");
local ValueName = "Location";
local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", FolderPath);
end
end
-- Location method: Current folder
-- Check whether the software is installed in the folder
-- that the patch was run from.
-- Remove the following block comment to enable this script
if not g_InstalledVersion then
g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", _SourceFolder);
if g_InstalledVersion then
SessionVar.Set("%AppFolder%", _SourceFolder);
end
end
-- Location method: File search
-- Search the user's system for a file that is known to
-- exist in the software's application folder.
if not g_InstalledVersion then
local TargetFileName = "autorun.cdd";
local tbFolders = {};
tbFolders[1] = SessionVar.Expand("%ProgramFilesFolder%\\My Project");
tbFolders[2] = SessionVar.Expand("%ProgramFilesFolder%");
-- Insert other folders here...
local CheckFixedDrives = true;
local CheckNetworkDrives = false;
-- (g_FindApplicationOnSystem is defined in _Global_Functions.lua)
g_InstalledVersion = g_FindApplicationOnSystem("%AppFolder%", TargetFileName, tbFolders, CheckFixedDrives, CheckNetworkDrives);
end
--------------------------------------------------------------
-- Ensure that installed software is not running
--------------------------------------------------------------
-- If we located an out-of-date version, make sure the installed
-- software is not running.
-- Remove the following block comment to enable this script
if g_InstalledVersion then
local Filename = SessionVar.Expand("autorun.cdd");
local ProgramName = SessionVar.Expand("My Project");
-- (g_EnsureProgramIsClosed is defined in _Global_Functions.lua)
local ProgramIsClosed = g_EnsureProgramIsClosed(Filename, ProgramName);
if not ProgramIsClosed then
Application.Exit(EXIT_REASON_PROGRAM_IS_OPEN);
end
end
--------------------------------------------------------------
-- Set session variables
--------------------------------------------------------------
-- Set session variables that will be used in the log file
-- and in the user interface.
if g_InstalledVersion then
SessionVar.Set("%InstalledVersion%", g_InstalledVersion);
SessionVar.Set("%TargetVersion%", VisualPatch.GetTargetVersion());
end
--------------------------------------------------------------
-- Log result
--------------------------------------------------------------
-- Make a log file entry with the result.
if g_InstalledVersion then
local LogMsg = SessionVar.Expand("Success\tLocated installed version %InstalledVersion%: %AppFolder%\r\n");
VisualPatch.WriteToLogFile(LogMsg);
else
local LogMsg = SessionVar.Expand("Error\tCould not locate software on system\r\n");
VisualPatch.WriteToLogFile(LogMsg);
end
--------------------------------------------------------------
-- Select start screen
--------------------------------------------------------------
-- Decide which "Before Patching" screen to show.
if g_InstalledVersion then
if g_InstalledVersion == VisualPatch.GetTargetVersion() then
-- The target version was found
Screen.SetStartScreen("Software is Current");
else
-- An out-of-date version was found
Screen.SetStartScreen("Ready to Patch");
end
else
-- No version was found
Screen.SetStartScreen("Cannot Locate Software");
end
What am I missing?
Comment