[osgeo4w-dev] pkg-shell: 2 new PATH utilities

Matt Wilkie matt.wilkie at gov.yk.ca
Fri Mar 30 13:47:50 PDT 2012


My earlier message was wrong, addpath is used by setting a variable first:

{{{
set _path=%OSGEO4W_ROOT%bin
call %OSGEO4W_ROOT%\bin\addpath.bat _path
set _path=
}}}

I'm not sure why the author uses that method when passing the actual 
desired path would be more straightforward, from a user's point of view. 
However as I don't understand everything the file does I'm not going to 
mess with it just yet.

The above is now part of pkg-shell v 1.0.0-9, which has been tested and 
works on my machine. I promoted it to regular use. More testing and 
feedback welcome.

cheers,

matt wilkie
--------------------------------------------
Geomatics Analyst
Information Management and Technology
Yukon Department of Environment
10 Burns Road * Whitehorse, Yukon * Y1A 4Y9
867-667-8133 Tel * 867-393-7003 Fax
http://environmentyukon.gov.yk.ca/geomatics/
--------------------------------------------


On 30-Mar-2012 12:31 PM, Matt Wilkie wrote:
> Hi Folks,
>
> As indicated in ticket #284 I believe I've found a relatively robust
> method for cleanly adding directories to PATH without risk of duplicate
> entries.  There are now (about to be) 2 new batch files in the Shell
> package: inpath and addpath.
>
> INPATH: Is the specified directory in PATH?||||The result is returned as
> the ERRORLEVEL:
>
> 0 if the pathVar path is found in PATH.
> 1 if the pathVar path is not found in PATH.
> 2 if pathVar is missing or undefined or if PATH is undefined.
>
> Example use:
>
>      |set test=c:\osgeo4w\bin|
>      |call inPath test&&  (echo found) || (echo not found)|
>
>
> ADDPATH:  Safely appends the path contained within variable pathVar to
> the end of PATH if and only if the path does not already exist within
> PATH. Use "/b" to prepend to beginning.
>
> Example use:
>
>      |addpath /b %OSGEO4W_ROOT%|
>      ||
>
>
> See
> http://stackoverflow.com/questions/141344/how-to-check-if-directory-exists-in-path
> for detailed info on what these scripts do and how they're built.
>


More information about the osgeo4w-dev mailing list