Browse Source

reflect $INSTDIR in grass70.py for starting the WinGrass70-installation

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@42332 15284696-431f-4ddb-bdfa-cd5b030d7da7
Helmut Kudrnovsky 15 years ago
parent
commit
a1af6b9af6
1 changed files with 77 additions and 0 deletions
  1. 77 0
      mswindows/GRASS-Installer.nsi

+ 77 - 0
mswindows/GRASS-Installer.nsi

@@ -320,6 +320,71 @@ FunctionEnd
 ;	
 ;FunctionEnd
 
+;ReplaceLineString Function
+;Replace String in an existing file
+
+;----------------------------------------------------------------------------------------------------------------------------
+; code taken from http://nsis.sourceforge.net/Replace_line_that_starts_with_specified_string
+
+Function ReplaceLineStr
+ Exch $R0 ; string to replace that whole line with
+ Exch
+ Exch $R1 ; string that line should start with
+ Exch
+ Exch 2
+ Exch $R2 ; file
+ Push $R3 ; file handle
+ Push $R4 ; temp file
+ Push $R5 ; temp file handle
+ Push $R6 ; global
+ Push $R7 ; input string length
+ Push $R8 ; line string length
+ Push $R9 ; global
+ 
+  StrLen $R7 $R1
+ 
+  GetTempFileName $R4
+ 
+  FileOpen $R5 $R4 w
+  FileOpen $R3 $R2 r
+ 
+  ReadLoop:
+  ClearErrors
+   FileRead $R3 $R6
+    IfErrors Done
+ 
+   StrLen $R8 $R6
+   StrCpy $R9 $R6 $R7 -$R8
+   StrCmp $R9 $R1 0 +3
+ 
+    FileWrite $R5 "$R0$\r$\n"
+    Goto ReadLoop
+ 
+    FileWrite $R5 $R6
+    Goto ReadLoop
+ 
+  Done:
+ 
+  FileClose $R3
+  FileClose $R5
+ 
+  SetDetailsPrint none
+   Delete $R2
+   Rename $R4 $R2
+  SetDetailsPrint both
+ 
+ Pop $R9
+ Pop $R8
+ Pop $R7
+ Pop $R6
+ Pop $R5
+ Pop $R4
+ Pop $R3
+ Pop $R2
+ Pop $R1
+ Pop $R0
+FunctionEnd
+
 ;----------------------------------------------------------------------------------------------------------------------------
 
 ;Interface Settings
@@ -761,6 +826,18 @@ Section "GRASS" SecGRASS
 	
 	CreateDirectory	$INSTALL_DIR\msys\home\$USERNAME\.grass7
 	CopyFiles $PROFILE\.grass7\rc $INSTALL_DIR\msys\home\$USERNAME\.grass7
+	
+		;replace gisbase = "/c/OSGeo4W/apps/grass/grass-7.0.svn" in grass70.py with $INSTDIR
+	 Push "$INSTDIR\grass70.py" ; file to modify
+	 Push 'gisbase = "/c/OSGeo4W/apps/grass/grass-7.0.svn"' ; string that a line must begin with *WS Sensitive*
+	 Push 'gisbase = "$INSTDIR"' ; string to replace whole line with
+	Call ReplaceLineStr
+	
+	;replace config_projshare = "/c/OSGeo4W/share/proj" i n grass70.py with $INSTDIR\proj
+	Push "$INSTDIR\grass70.py" ; file to modify
+	Push 'config_projshare = "/c/OSGeo4W/share/proj"' ; string that a line must begin with *WS Sensitive*
+	Push 'gisbase = "$INSTDIR\proj"' ; string to replace whole line with
+	Call ReplaceLineStr
                  
 SectionEnd