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

Matt Wilkie matt.wilkie at gov.yk.ca
Fri Mar 30 12:31:57 PDT 2012


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.

-- 
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/
--------------------------------------------



More information about the osgeo4w-dev mailing list