Archive: Looking for Rexx SearchPath function


Looking for Rexx SearchPath function
The following link describes the Rexx SearchPath function in detail

http://www.borg.com/~jglatt/rexx/scr...htm#SEARCHPATH

In brief, given a PATH-style environment variable (string of directory names separated by semi-colons) and a filename, the function will return the first matching filename found.

fullname = SEARCHPATH(path, filename)

Has anyone implemented something similar to this for NSIS? This type of functionality is very important when you are trying to find a previous installation which may not have been installed with a means of tracking it.

this is often true with opensource security software such as OpenSSL and MIT Kerberos for Windows which has been bundled with just about every application that uses it since there is no standard installation procedure.

Thanks for your help.


Get the PATH envrionment variable using ExpandEnvStrings, parse it using string commands like StrCpy and StrCmp and search using FindFirst/FindNext/FindClose.


so the answer is 'no'
Joost, thank you for your reply. Although a simply 'no' I have not would have been sufficient. Clearly the building blocks are available to perform the search, it just would have been nicer if the function was available for inclusion.


You can write your own functions using the NSIS script language and share them with other users in the NSIS Archive.

There are already file search functions and PATH variable modification function available, so you would only have to combine them to get what you want.

And if you create one, other can benefit from it too.


SearchPath function implementation
Attached is a SearchPath implementation. Feel free to insert it into the archive. In exchange, please explain how ExpandEnvStrings and ReadEnvStr are supposed to work. I can't figure it out.

ReadEnvStr $R0 "PATH"

sets $R0 to the empty string.

ExpandEnvStrings $R0 "PATH"

sets $R0 to "PATH".

Thanks.


To get the content of a single variable you should use ReadEnvStr.

ReadEnvStr $R0 "PATH"

is the correct syntax and works for me.


As indicated it does not work for me. NSIS 2.0 RC2 built from source with MSVC 6.0. Installer running on Windows XP SP1.


What's the output when you enter PATH in the command line?


I obtain the PATH

[C:\]PATH
Path=C:\Program Files\Windows Resource Kits\Tools\;C:\Tcl\bin;C:\Perl\bin\;C:\PROGRAM FILES\THINKPAD\UTILITIES;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System3
2\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\ATI
Technologies\Fire GL 3D Studio Max;C:\Program Files\ATI Technologies\Fire GL Control Panel;C:\Program Files\PC-Doctor for Windows\services;C:\Program Files\Common Files\Adaptec Shared\System;c:\program files\resource kit\bin;c:\perl\bin;c:\
ssleay32;c:\kerberos;c:\kermit;c:\rse;c:\rse\nt;c:\tools\hamilton\bin;c:\tools\mks\mksnt;C:\Program Files\Support Tools\;c:\tools\sysinternals;C:\Program Files\OpenAFS\Client\Program;C:\Program Files\OpenAFS\Common;C:\Adabas\bin;C:\Adabas\pgm


Are you absolutely sure your script is correct? I tested it on multiple systems and it always gives the right output.

Try:

ReadEnvStr $R0 "PATH"
MessageBox MB_OK $R0


I copied your text exactly as you wrote it and pasted it followed by an "abort" command to the very beginning of the .onInit function. The end result is a message box displaying the empty string.

Is there anyway to build a debug version of the generated installer?


Maybe the string is too large for the default string size. Try to increase NSIS_MAX_STRLEN in exehead\config.h


increasing to 4096 did indeed solve the problem.

fyi, it would be a good idea to autogenerate the makenssi.mak and makenssi.dep files from the makenssi.dsw project. that would allow the .NET2003 compiler to be used to build the project from the command line. Unfortunately, I have not figured out yet how to generate makefiles from .NET2003.


Makefiles are published in this topic:

http://forums.winamp.com/showthread....hreadid=163009

We are still looking for someone who wants to test these files with the free .NET command line compiler.

Any help would be great.


well, I don't have the "free" compiler. I have the complete set of MSVC++ 6.0, MSVS.NET, and MSVS.NET2003 tools. Using MSVC++ 6.0 I have generated the .mak and .dep files and then successfully used them to build NSIS with the MSVS.NET2003 compiler.

I can provide the generated .dep and .mak files if you desire them.