I wrote a new VBScript which resolves relative paths and assign the new value to the delivered property, further down you can see the new script:
if you call this script via Advanced Installer you have to type follow into the ActionData-Field: "PropertyName|RelativePath" (without "") as example you can Type: "SecondAppDir|[APPDIR]..\..\SecAppDir" (without "") and it will resolve the path and assign it to the property SecondAppDir. If the delivered path isn't relative it just assign it to the property and will exit then.
Code: Select all
Dim params, prop, path, splitPath, endsWithBack, elmCounter
' ActionData abrufen und spliten
params = Split( Session.Property("CustomActionData"), "|", 2)
' Parameter zuweisen
prop = params(0)
path = params(1)
' Prüfen, ob es mit einem Backslash endet
If Right(path, 1) = "\" Then
endsWithBack = 1
Else
endsWithBack = 0
End If
' Prüfen, ob es ein relativer Pfad ist
If InStr(path, "\..") > 1 Then
' Splitten und iterieren
splitPath = Split(path, "\")
For i = 0 to (UBound(splitPath) - 1)
' Falls es ein ".." ist, muss das zu ersetzende Element ermittelt und geleert werden
' zusätzlich muss man das momentane Element auch leeren, damit es beim zusammensetzen
' nicht wieder relativ wird.
If splitPath(i) = ".." then
elmCounter = 1
While splitPath(i - elmCounter) = ""
elmCounter = elmCounter + 1
Wend
splitPath(i - elmCounter) = ""
splitPath(i) = ""
End If
Next
' Nach dem alle relativen Teile aufgelöst wurden,
' wird der Pfad jetzt wieder zusammengesetzt.
path = ""
For Each pPath in splitPath
If pPath <> "" Then
path = path + pPath + "\"
End If
Next
' Falls der Anfangspfad nicht mit einem Backslash endet,
' wird dieser hier wieder abgeschnitten.
If endsWithBack = 0 Then
path = Left(path, Len(path) - 1)
End If
End If
Session.Property(prop) = path
If somebody has a question, send me a PN or ask it here.
best regards
Blueberry
FOLLOW US
Get the latest news in Application Packaging