|
#1
|
||||
|
||||
|
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: 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
Quote:
|
|
#2
|
||||
|
||||
|
%AppFolder% is where?
I've noticed the default VisualPatch.CheckFolderVersion as provided by the wizard to locate and assign the %AppFolder% variable but it doesn't work. It's showing results for %AppFolder% as %AppFolder%. Any thoughts?
Code:
-- 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
|
|
#3
|
||||
|
||||
|
Quote:
This line in your code stands out a bit: Code:
-- 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
(See the help topic for the CheckFolderVersion action.) What destination paths do your key files have? Do your key files contain different data between those two versions, so the patch can tell them apart by their MD5 values? Another thing to check is the order your version tabs are listed in your project. (The newest version is assumed to be the one on the far right.) BTW, it doesn't hurt to verify the key files you have on your build system and on the target system. Use a tool like fsum to check the MD5 values. (You would be surprised how often people are mistaken when they're certain which version is installed. It isn't that hard to lose your place a bit when testing patches.)
__________________
--[[ Indigo Rose Software Developer ]] |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Visual Patch 3.0 Simplifies Software Patch Packaging | Ted Sullivan | Announcements & News | 0 | 08-07-2007 02:38 PM |
| Press Release: Visual Patch Express Eases the Creation of Software Patches | Ted Sullivan | Announcements & News | 0 | 03-20-2007 12:57 PM |
| Key Features of Visual Patch 2.0 | Ted Sullivan | Visual Patch 2.0 | 0 | 04-08-2005 03:56 PM |
| What's New in Visual Patch 2.0? | Ted Sullivan | Visual Patch 2.0 | 0 | 04-08-2005 03:53 PM |
| Frequently Asked Questions | Ted Sullivan | Visual Patch 2.0 | 0 | 04-08-2005 03:49 PM |
All times are GMT -6. The time now is 08:38 AM.







Linear Mode

