Alas, MSI does insist on trailing backslashes for properties in the Directory table...
But here's a copy-and-paste custom action that will set a property to a Directory value minus the trailing backslash; you can then use the form [INSTALLDIRWITHOUTSLASH] in MSI fields that use the Formatted data type (such as many fields of the Registry and IniFile fields).
(Examples of inserting custom actions in a database are covered in Chapters 8 and 16, since --- thanks! --- you have a copy of the book...)
[code]' since the function uses Directory properties,
' schedule for immediate mode,
' in Execute sequence after CostFinalize;
' VBScript action type, function name RemoveLastSlash, ...
Function RemoveLastSlash( )
' TO DO: replace INSTALLDIR with your desired property
pathOrig = Property("INSTALLDIR")
If (Right(pathOrig, 1) = "\") Then
pathWithoutSlash = Left(pathOrig, Len(pathOrig) - 1)
Else ' do nothing
pathWithoutSlash = pathOrig
End If
' create a property that you can use in the Registry
' views as [INSTALLDIRWITHOUTSLASH]...
Property("INSTALLDIRWITHOUTSLASH") = pathWithoutSlash
RemoveLastSlash = 1 ' return success to MSI
End Function[/code]
P.S. If you want to use [INSTALLDIRWITHOUTSLASH] as a shortcut's working directory, you'll need to add a dummy INSTALLDIRWITHOUTSLASH record to the Directory table...