Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#32 closed defect (fixed)

the template for batch files should have a quoted path, else CALL fails

Reported by: maphew Owned by: osgeo4w-dev@…
Priority: major Component: Installer
Version: Keywords:
Cc:

Description

If there is a space in OSGEO4W_ROOT the call will fail. The fix is to quote %%f. Using current qgis.bat.tmpl as an example, the corrected template is:

@echo off

SET OSGEO4W_ROOT=@osgeo4w@
PATH %OSGEO4W%\bin;%PATH%
for %%f in ("%OSGEO4W_ROOT%"\etc\ini\*.bat) do call "%%f"
start /B %OSGEO4W_ROOT%\bin\qgis.exe %*

Note: for some reason Windows is smart about quotes when setting PATH, so they are not needed there. Likewise the embedded quote within the FOR ... IN does not cause a problem.

Change History (3)

comment:1 by maphew, 15 years ago

just noticed the PATH statement is missing root (check the qgis package) make that:

@echo off

SET OSGEO4W_ROOT=@osgeo4w@
PATH %OSGEO4W_ROOT%\bin;%PATH%
for %%f in ("%OSGEO4W_ROOT%"\etc\ini\*.bat) do call "%%f"
start /B %OSGEO4W_ROOT%\bin\qgis.exe %*

comment:2 by maphew, 15 years ago

Resolution: fixed
Status: newclosed

I've added a template to the Packaging Instruction page for launching an application with the standard osgeo4w environment settings here

comment:3 by maphew, 15 years ago

better solution (also documented in packaging instructions):

@echo off
SET OSGEO4W_ROOT=@osgeo4w@
call %OSGEO4W_ROOT%\bin\o4w_env.bat
start /B %OSGEO4W_ROOT%\bin\foo.exe %*
@echo on
Note: See TracTickets for help on using tickets.