I'm creating an MSI using WiX, and that MSI accepts as a user-input property, the path to a file name that the installer logic will be using. I'm trying to validate the property by determining whether that file exists, but with a full file path I can't figure out how to get that to cooperate with the DirectorySearch
and FileSearch
pattern.
So, say the user runs the MSI like:
msiexec /i myinstaller.msi CUSTOMFILE="C:\test\input.txt"
I would then need to run something like:
<Property Id="CUSTOMFILEEXISTS">
<DirectorySearch
Id="LocationConfigDirSearch"
Path="[CUSTOMFILE_DIR]" Depth="0">
<FileSearch Name="[CUSTOMFILE_FILENAME]"></FileSearch>
</DirectorySearch>
</Property>
But I:
- Can't figure out how to split the filename into its parts. Something like
Path.GetDirectory([CUSTOMFILE])
andPath.GetFileName([CUSTOMFILE])
would be ideal. or; - Can't figure out how to determine whether the file exists using the full file name as-is. Say for example, a property on
DirectorySearch
forIgnoreFileName="true"
, but I know such a property does not exist.
Do I need to go to the extent of writing extension code or a custom action? I'm hoping this is a simple enough requirement that it won't need to go that far.