问题
I'm creating a plugin for Adobe Illustrator and I'm attempting to make an installer for it using WiX. So in order to get the plugin to install in the correct location I am reading the registry to find the most up to date version of illustrator and then find the file path to that Illustrator exe. This all works fine and gives me "C:\Program Files\Adobe\Illustrator CC 2018\Support Files\Contents\Windows\Illustrator.exe"
(I've checked and if you choose to install it elsewhere this path reflects that). Plugins are installed in "C:\Program Files\Adobe\Illustrator CC 2018\Plug-ins"
.
So what I'm now trying to do is using the path to the exe get a relative path to the Plug-ins folder. Is there an easy way to do this in WiX?
I've tried to use
<CustomAction Id="SETDIRECTORY" Property="PLUGINFOLDER" Value="[ILLUSTRATOREXEPATH]..\..\..\Plug-ins" />
but this throws an error saying that .. is an invalid character
EDIT:
I've know managed to work out how to get the directory of the file by using the RegistrySearch Type "file", giving me "C:\Program Files\Adobe\Illustrator CC 2018\Support Files\Contents\Windows\"
but can't work out how to get the parent directory without using a script (something I don't want to have to resort to as it can apparently cause issues with anti virus).
回答1:
Did you search through the registry or INI files or other settings files on disk to determine if the full path to the plugins folder is written anywhere and ready for use?
There are good chances the full path is written somewhere, or you will find a base folder that you can just add sub folders to in the fashion you already did, but without the parent directory sections that cause you problems.
In addition to simply looking through or searching the registry and disk for clues, inspecting the original installation MSI can also provide clues as to where this path is written. Look in the IniFile table
, Registry table
, Environment table
and similar.
If you don't have a tool to peruse MSI files with, perhaps see this answer (towards bottom - list of free tools): How can I compare the content of two (or more) MSI files?
I will throw in a tech-note in case you don't have the original installer. During installation a copy of the installation MSI will be made on your system. You can open this file to search for settings.
This VBScript snippet should show all cached packages for Adobe products. Put it in a *.vbs file on your desktop and just run it. A message box pops up with any result (blank if nothing is found). Open the MSI path specified - and make no changes to this file! (or better yet, make a copy of it to the desktop and open it from there).
On Error Resume Next ' we ignore all errors
Set installer = CreateObject("WindowsInstaller.Installer")
Dim adobeproducts
For Each product In installer.ProductsEx("", "", 7)
name = product.InstallProperty("ProductName")
cachedpackage = product.InstallProperty("LocalPackage")
If InStr(LCase(name), "adobe") Then
adobeproducts = adobeproducts + name & ", " & cachedpackage & vbCrLf & vbCrLf
End If
Next
MsgBox adobeproducts
来源:https://stackoverflow.com/questions/49149263/wix-get-directory-from-file-path