Opened 8 years ago

Closed 8 years ago

Last modified 6 years ago

#276 closed defect (fixed)

Osgeo4w.bat problem with setting root

Reported by: maphew Owned by: maphew
Priority: major Component: Package
Version: Keywords: pkg-shell, msvcrt
Cc:

Description

Osgeo4w.bat has a line in it to remove the trailing backslash from the auto-generated OSGEO4W_ROOT variable. Most of the time this works just fine, however if the root happens to be the top of a drive instead of a folder unexpected things can happen.

The immediate fix is to REMark out the line, as shown below. It should be safe and have no functional repercussions.

rem Remove trailing backslash
rem set OSGEO4W_ROOT=%OSGEO4W_ROOT:~0,-1%

The purpose of the line is largely cosmetic, it prevents a double backslash appearing in things like PATH=%OSGEO4W_ROOT%\bin; (becomes PATH=C:\Osgeo4w\\bin;). In testing Windows seems to ignore double slashes faithfully and completely.

Without the fix in place, if osgeo4w_root is a drive letter (X:), then it become relative to whatever the current directory on the drive is instead of the absolute location.

The next release of pkg-shell will have a fix.

Change History (5)

comment:1 Changed 8 years ago by jef

FTR%~dp0\.. apparently does not work on Windows 2000 (see QGIS #5151)

comment:2 Changed 8 years ago by maphew

Resolution: fixed
Status: newclosed

fixed for XP, Vista and Win7 with package release 1.0.0-9.

As for the qgis issue report , I can't test on Windows 2000, but I believe using cd /d %~dp0 instead of pushd %~dp0 might work for all 4 Windows versions.

comment:3 in reply to:  2 Changed 8 years ago by jef

Replying to maphew:

fixed for XP, Vista and Win7 with package release 1.0.0-9.

As for the qgis issue report , I can't test on Windows 2000, but I believe using cd /d %~dp0 instead of pushd %~dp0 might work for all 4 Windows versions.

Did you read the QGIS ticket? pushd %~dp0 works, just pushd %~dp0\.. doesn't.

comment:4 Changed 8 years ago by maphew

read it, but misunderstood the actual problem. Thanks for not letting that slip by.

I've updated o4w_env.bat in pkg-msvcrt accordingly.

comment:5 Changed 6 years ago by jef

Keywords: msvcrt added
Note: See TracTickets for help on using tickets.