I'm trying to keep this simple and I'm using VP 2.0 to patch version 1.1 to version 1.1.1 of my software. The patch is returning that the current version is already installed when it's clearly not. The installed version is 1.1 on the system but the patch is saying that version 1.1.1 is installed.
What am I doing wrong?
Here's the code I have:
Here is the log txt:
What am I doing wrong?
Here's the code I have:
Code:
-------------------------------------------------------------- -- 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("%ProgramFilesFolder%\\%CompanyName%\\%ProductName%", _SourceFolder); if g_InstalledVersion then SessionVar.Set("%AppFolder%", _SourceFolder); end end Dialog.Message("%AppFolder% contains:", SessionVar.Expand("%AppFolder%")); -- Location method: Registry key -- Read a folder path from the Registry. -- Remove the following block comment to enable this script --[[ if not g_InstalledVersion then local MainKey = HKEY_CURRENT_USER; local SubKey = SessionVar.Expand("Software\\%CompanyName%\\%ProductName%"); 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 ]] -- Location method: File search -- Search the user's system for a file that is known to -- exist in the software's application folder. -- Remove the following block comment to enable this script --[[ if not g_InstalledVersion then local TargetFileName = "Award Quick.exe"; local tbFolders = {}; tbFolders[1] = SessionVar.Expand("%ProgramFilesFolder%\\Army Counseling Online\\Award Quick"); -- tbFolders[2] = SessionVar.Expand("%ProgramFilesFolder%\\%CompanyName%"); -- tbFolders[3] = SessionVar.Expand("%ProgramFilesFolder%\\%CompanyName%\\%ProductName%"); -- 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. if g_InstalledVersion then local Filename = SessionVar.Expand("Award Quick.exe"); local ProgramName = SessionVar.Expand("Award Quick"); -- (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
[11/27/2007 08:44:47] Success Patch started: C:\Program Files\Army Counseling Online\Award Quick\AQpatch.exe
[11/27/2007 08:44:47] Notice Patch engine version: 2.0.4.0
[11/27/2007 08:44:47] Notice Product: Award Quick
[11/27/2007 08:44:47] Success Language set: Primary = 9, Secondary = 1
[11/27/2007 08:44:47] Success Include script: _Global_Functions.lua
[11/27/2007 08:44:47] Notice Start project event: Global Functions
[11/27/2007 08:44:47] Success Run project event: Global Functions
[11/27/2007 08:44:47] Notice Start project event: On Startup
[11/27/2007 08:44:54] Success Located installed version 1.1.1: C:\Program Files\Army Counseling Online\Award Quick
[11/27/2007 08:44:54] Success Run project event: On Startup
[11/27/2007 08:44:54] Success Display screen: Software is Current
[11/27/2007 08:44:58] Success Delete image file: C:\Users\Steve\AppData\Local\Temp\_ir_vp2_temp_0\I RIMG1.JPG
[11/27/2007 08:44:58] Success Delete image file: C:\Users\Steve\AppData\Local\Temp\_ir_vp2_temp_0\I RIMG2.JPG
[11/27/2007 08:44:58] Success Delete image file: C:\Users\Steve\AppData\Local\Temp\_ir_vp2_temp_0\I RIMG3.JPG
[11/27/2007 08:44:58] Notice Exit patch process (Return code: 1240)
[11/27/2007 08:44:47] Notice Patch engine version: 2.0.4.0
[11/27/2007 08:44:47] Notice Product: Award Quick
[11/27/2007 08:44:47] Success Language set: Primary = 9, Secondary = 1
[11/27/2007 08:44:47] Success Include script: _Global_Functions.lua
[11/27/2007 08:44:47] Notice Start project event: Global Functions
[11/27/2007 08:44:47] Success Run project event: Global Functions
[11/27/2007 08:44:47] Notice Start project event: On Startup
[11/27/2007 08:44:54] Success Located installed version 1.1.1: C:\Program Files\Army Counseling Online\Award Quick
[11/27/2007 08:44:54] Success Run project event: On Startup
[11/27/2007 08:44:54] Success Display screen: Software is Current
[11/27/2007 08:44:58] Success Delete image file: C:\Users\Steve\AppData\Local\Temp\_ir_vp2_temp_0\I RIMG1.JPG
[11/27/2007 08:44:58] Success Delete image file: C:\Users\Steve\AppData\Local\Temp\_ir_vp2_temp_0\I RIMG2.JPG
[11/27/2007 08:44:58] Success Delete image file: C:\Users\Steve\AppData\Local\Temp\_ir_vp2_temp_0\I RIMG3.JPG
[11/27/2007 08:44:58] Notice Exit patch process (Return code: 1240)
Comment