I have a au3.properties file that adds a search command to the right click context menu. This command does a FINDSTR on all .au3 files in the "Program Files" directory. However, on 32 bit Windows 7 and 8.1 OS's, 32 bit executables are now run from a "Program Files (x86)" directory.
I have a construct that builds a path variable that holds the locations to search. In this variable, I have both "Program Files" and "Program Files (x86)", as well as a directory that holds my library file.
The constructor looks like this:
findcmd="C:\Windows\System32\Findstr.exe"
myLib="C:\Andy\AutoIT-src\myLib"
where1="C:\Program Files\autoit3\include\*.au3" "C:\Program Files (x86)\autoit3\include\*.au3" $(myLib)\*.au3
Then in the command definition, I use it like this:
# "Find Definitions"
# Look in the C:\Program Files (x86)\AutoIt3\Include directory for any .au3 file
# that has a definition for the currently selected word (or the word the
# cursor is on)
#
command.name.42.$(au3)=
command.42.$(au3)=$(findcmd) /N /R /I /C:"^global [0-9a-f].* $(CurrentWord) =" $(where1)
command.subsystem.42.$(au3)=0
command.save.before.42.$(au3)=2
The problem is that on 32 bit systems without the "Program Files (x86)" directory, I get this error:
FINDSTR: Cannot open C:\Program Files (x86)\autoit3\include\*.au3
I think that what I need is an 'if then else' something like this:
if exists "C:\Program Files (x86)" then
where1=""C:\Program Files (x86)" $(myLib)\*.au3
else
where1=""C:\Program Files" $(myLib)\*.au3
endif
How can I conditionally define the search path?