set ICON=%OSGEO4W_ROOT%\apps\grass\grass84\gui\icons\grass_osgeo.ico
set BATCH=%OSGEO4W_ROOT%\bin\grass84.bat
textreplace -std -t "%BATCH%"
textreplace -std -t "%OSGEO4W_ROOT%\apps\grass\grass84\etc\fontcap"

for /F "tokens=* USEBACKQ" %%F IN (`getspecialfolder Documents`) do set DOCUMENTS=%%F

if not %OSGEO4W_MENU_LINKS%==0 xxmklink "%OSGEO4W_STARTMENU%\GRASS GIS 8.4.1.lnk" "%BATCH%"  "--gui" "%DOCUMENTS%" "Launch GRASS GIS 8.4.1" 1 "%ICON%"
if not %OSGEO4W_DESKTOP_LINKS%==0 xxmklink "%OSGEO4W_DESKTOP%\GRASS GIS 8.4.1.lnk" "%BATCH%"  "--gui" "%DOCUMENTS%" "Launch GRASS GIS 8.4.1" 1 "%ICON%"

rem run g.mkfontcap outside a GRASS session during
rem an OSGeo4W installation for updating paths to fonts

rem set gisbase
set GISBASE=%OSGEO4W_ROOT%\apps\grass\grass84

rem set path to freetype dll and its dependencies
set FREETYPEBASE=%OSGEO4W_ROOT%\bin;%OSGEO4W_ROOT%\apps\msys\bin;%GISBASE%\lib

rem set dependencies to path
set PATH=%FREETYPEBASE%;%PATH%

rem GISRC must be set
set GISRC=dummy

rem run g.mkfontcap outside a GRASS session
"%GISBASE%\bin\g.mkfontcap.exe" --overwrite

del "%BATCH%.tmpl
copy "%OSGEO4W_ROOT%\bin\concrt140.dll" "%OSGEO4W_ROOT%\apps\grass\grass84\bin\concrt140.dll"
copy "%OSGEO4W_ROOT%\bin\msvcp140.dll" "%OSGEO4W_ROOT%\apps\grass\grass84\bin\msvcp140.dll"
copy "%OSGEO4W_ROOT%\bin\msvcp140_1.dll" "%OSGEO4W_ROOT%\apps\grass\grass84\bin\msvcp140_1.dll"
copy "%OSGEO4W_ROOT%\bin\msvcp140_2.dll" "%OSGEO4W_ROOT%\apps\grass\grass84\bin\msvcp140_2.dll"
copy "%OSGEO4W_ROOT%\bin\msvcp140_atomic_wait.dll" "%OSGEO4W_ROOT%\apps\grass\grass84\bin\msvcp140_atomic_wait.dll"
copy "%OSGEO4W_ROOT%\bin\msvcp140_codecvt_ids.dll" "%OSGEO4W_ROOT%\apps\grass\grass84\bin\msvcp140_codecvt_ids.dll"
copy "%OSGEO4W_ROOT%\bin\vccorlib140.dll" "%OSGEO4W_ROOT%\apps\grass\grass84\bin\vccorlib140.dll"
copy "%OSGEO4W_ROOT%\bin\vcruntime140.dll" "%OSGEO4W_ROOT%\apps\grass\grass84\bin\vcruntime140.dll"
copy "%OSGEO4W_ROOT%\bin\vcruntime140_1.dll" "%OSGEO4W_ROOT%\apps\grass\grass84\bin\vcruntime140_1.dll"
copy "%OSGEO4W_ROOT%\bin\vcruntime140_threads.dll" "%OSGEO4W_ROOT%\apps\grass\grass84\bin\vcruntime140_threads.dll"
copy "%OSGEO4W_ROOT%\bin\vcamp140.dll" "%OSGEO4W_ROOT%\apps\grass\grass84\bin\vcamp140.dll"
copy "%OSGEO4W_ROOT%\bin\vcomp140.dll" "%OSGEO4W_ROOT%\apps\grass\grass84\bin\vcomp140.dll"
