[osgeo4w-dev] PATH ordering for OSGeo4W Shell
Matt Wilkie
matt.wilkie at gov.yk.ca
Tue Jul 17 10:09:04 PDT 2012
Hi Mike,
Short term, if you change your "Osgeo4W shell" menu and desktop
shortcuts to point to
C:\gnu\OSGeo4W\bin\o4w_env.bat
instead of "C:\gnu\Osgeo4W\Osgeo4W.bat" it should insert the o4w dirs to
the beginning of PATH. This is what Msys is doing.
However it's not a clean solution and there's still a chance of
unpredictable crossover between the two different versions. For example
something could call a library that isn't installed in Osgeo4W, but is
present in GWV6, resulting in weird error messages, or worse, no error
but silently return the wrong results. (I haven't actually seen this
happen, I just know it's possible.)
Longer term, we're talking about changing the shell startup to start
with a minimal path instead of just adding to what is already present.
> Why isn't gdalinfo.exe from OSGeo4W not used in preference over the
> other one installed in C:\GWV6\gdal\bin?
The technical answer is, the search order for PATH is from left to
right, so earlier entries are found first. Typically this reflects the
application install order.
More to your point though, up to this point the o4w shell has been
following a philosophy of add and extend, as opposed to clean house and
stand alone. Each has their own merits and warts.
> Here it looks like PATH has
> been modified by OSGeo4W to append two paths.
In your case it's actually 3, it's normal, and based on what you've
installed (Gdal, Msys, Python). Other packages could add more.
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 17-Jul-2012 12:19 AM, Mike Toews wrote:
> Hi all,
>
> I have some commercial third-party software installed on my computer
> that installed an older version of GDAL, including utilities, in it's
> own directory structure. This software also appended it's paths to the
> system PATH (done by the installer, not by my choice), so I could open
> any cmd.exe and type "gdalinfo --version" to see "GDAL 1.7.0dev,
> FWTools 2.4.4, released 2009/09/23".
>
> However, from an OSGeo4W Shell, I'd rather be using the OSGeo4W
> version of GDAL, but I'm not. Here's what I see from OSGeo4W Shell:
> C:\>gdalinfo --version
> GDAL 1.7.0dev, FWTools 2.4.4, released 2009/09/23
>
> C:\>where gdalinfo
> C:\GWV6\gdal\bin\gdalinfo.exe
> C:\gnu\OSGeo4W\bin\gdalinfo.exe
>
> C:\>c:\gnu\OSGeo4W\bin\gdalinfo.exe --version
> GDAL 1.9.1, released 2012/05/15
>
> C:\>PATH
> PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\GWV6\;C:\GWV6\gdal\bin;C:\Program
> Files (x86)\Java\jre6\bin;C:\gnu\OSGeo4W\bin;C:\gnu\OSGeo4W\\apps\msys\bin;C:\gnu\OSGeo4W\\apps\Python27\Scripts
>
> Why isn't gdalinfo.exe from OSGeo4W not used in preference over the
> other one installed in C:\GWV6\gdal\bin? Here it looks like PATH has
> been modified by OSGeo4W to append two paths.
>
> With the MSYS shell distributed with OSGeo4W, things look better:
>
> $ which gdalinfo
> /osgeo4w/bin/gdalinfo.exe
>
> $ gdalinfo --version
> GDAL 1.9.1, released 2012/05/15
>
> $ echo $PATH
> .:/usr/local/bin:/bin:/mingw/bin:/osgeo4w/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/c/GWV6/:/c/GWV6/gdal/bin:/c/Program
> Files (x86)/Java/jre6/bin:/bin:/osgeo4w/apps/Python27/Scripts
>
> Why is the PATH variable set with MSYS inserting some paths at the
> front, and appending others at the end? Should both shells be
> inserting the paths at the beginning of the PATH environment?
>
> -Mike
> _______________________________________________
> osgeo4w-dev mailing list
> osgeo4w-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/osgeo4w-dev
> .
>
More information about the osgeo4w-dev
mailing list