Skip to content

Commit 3ec2e4d

Browse files
committed
Don't prohibit installation for in-place upgrades from VA1 to VA2.
Resolves #2803 Related Work Items: #280
1 parent 2265263 commit 3ec2e4d

2 files changed

Lines changed: 47 additions & 5 deletions

File tree

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Full details of the variables available for each noted event, and VoiceAttack in
55
## 5.0.1
66
* Core
77
* Fixed generated consolidated organic names for Horizons organics.
8+
* Revised installer to allow installation when the VoiceAttack 1 and VoiceAttack 2 registry hives point to the same location (e.g. when VoiceAttack 2 is installed over an existing VoiceAttack 1 installation). (#2803)
89
* Speech Responder
910
* Fixed vertical whitespace characters being removed from speechresponder.out. (#2797)
1011
* Custom Functions

Installer.iss

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,39 @@ begin
154154
Result := (C = P) or (Pos(P + '\', C) = 1);
155155
end;
156156
157-
function GetDefaultInstallDir(Param: string): string;
157+
function TryGetVoiceAttack2AppsDir(var Dir: string): Boolean;
158158
var
159-
AppsFolder: string;
159+
VAFolder: string;
160160
begin
161+
Result := False;
162+
161163
if RegQueryStringValue(
162164
HKCU,
163165
'Software\VoiceAttack.com\VoiceAttack2\LastRun',
164166
'AppsFolder',
165-
AppsFolder) and (Trim(AppsFolder) <> '') then
167+
Dir) and (Trim(Dir) <> '') then
168+
begin
169+
Dir := RemoveBackslashUnlessRoot(Dir);
170+
Result := True;
171+
exit;
172+
end;
173+
174+
if RegQueryStringValue(
175+
HKCU,
176+
'Software\VoiceAttack.com\VoiceAttack2\LastRun',
177+
'VAFolder',
178+
VAFolder) and (Trim(VAFolder) <> '') then
179+
begin
180+
Dir := AddBackslash(RemoveBackslashUnlessRoot(VAFolder)) + 'Apps';
181+
Result := True;
182+
end;
183+
end;
184+
185+
function GetDefaultInstallDir(Param: string): string;
186+
var
187+
AppsFolder: string;
188+
begin
189+
if TryGetVoiceAttack2AppsDir(AppsFolder) then
166190
begin
167191
Result := AddBackslash(RemoveBackslashUnlessRoot(AppsFolder)) + '{#MyAppName}';
168192
exit;
@@ -226,11 +250,28 @@ end;
226250
function IsLegacyVoiceAttackPath(const Dir: string): Boolean;
227251
var
228252
LegacyAppsDir: string;
253+
VoiceAttack2AppsDir: string;
229254
begin
230255
Result := False;
231256
232-
if TryGetLegacyVoiceAttackAppsDir(LegacyAppsDir) then
233-
Result := IsUnderPath(Dir, LegacyAppsDir);
257+
if not TryGetLegacyVoiceAttackAppsDir(LegacyAppsDir) then
258+
exit;
259+
260+
{
261+
VoiceAttack supports an in-place v1 -> v2 upgrade. In that case both
262+
registry hives can legitimately point to the same Apps folder. Do not
263+
block the selected path as legacy when the v1 and v2 Apps folders match.
264+
}
265+
if TryGetVoiceAttack2AppsDir(VoiceAttack2AppsDir) and
266+
SamePath(LegacyAppsDir, VoiceAttack2AppsDir) then
267+
begin
268+
Log(Format(
269+
'VoiceAttack and VoiceAttack 2 are registered to the same Apps folder: "%s".',
270+
[LegacyAppsDir]));
271+
exit;
272+
end;
273+
274+
Result := IsUnderPath(Dir, LegacyAppsDir);
234275
end;
235276
236277
procedure RegisterCloseResource(const Dir: string);

0 commit comments

Comments
 (0)