Bläddra i källkod

winGRASS standalone installer: don't overwrite GISRC if exists

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49490 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 år sedan
förälder
incheckning
103c9d8be3
1 ändrade filer med 23 tillägg och 16 borttagningar
  1. 23 16
      mswindows/GRASS-Installer.nsi

+ 23 - 16
mswindows/GRASS-Installer.nsi

@@ -868,19 +868,23 @@ Section "GRASS" SecGRASS
   
 	;replace \ with / in $GIS_DATABASE
 	${StrReplace} "$UNIX_LIKE_GIS_DATABASE_PATH" "\" "/" "$GIS_DATABASE"
-  
-	;create $APPDATA\GRASS7\rc
-	SetShellVarContext current
-	ClearErrors
-	CreateDirectory	$APPDATA\GRASS7
-	FileOpen $0 $APPDATA\GRASS7\rc w
-	IfErrors done_create_grass7\rc
-	FileWrite $0 'GISDBASE: $UNIX_LIKE_GIS_DATABASE_PATH$\r$\n'
-	FileWrite $0 'LOCATION_NAME: demolocation$\r$\n'
-	FileWrite $0 'MAPSET: PERMANENT$\r$\n'
-	FileClose $0	
-	done_create_grass7\rc:
-	
+
+	SetShellVarContext current  
+	${If} ${FileExists} "$APPDATA\GRASS7\rc"
+	      DetailPrint "File $APPDATA\GRASS7\rc already exists. Skipping."
+	${Else}
+	      ;create $APPDATA\GRASS7\rc
+	      ClearErrors
+	      CreateDirectory	$APPDATA\GRASS7
+	      FileOpen $0 $APPDATA\GRASS7\rc w
+	      IfErrors done_create_grass7_rc
+	      FileWrite $0 'GISDBASE: $UNIX_LIKE_GIS_DATABASE_PATH$\r$\n'
+	      FileWrite $0 'LOCATION_NAME: demolocation$\r$\n'
+	      FileWrite $0 'MAPSET: PERMANENT$\r$\n'
+	      FileClose $0	
+	      done_create_grass7_rc:
+	${EndIf}
+
 	;replace gisbase = "/c/OSGeo4W/apps/grass/grass-7.0.svn" in grass70.py with $INSTDIR
 	Push "$INSTDIR\etc\grass70.py" ; file to modify
 	Push 'gisbase = "/c/OSGeo4W/apps/grass/grass-7.0.svn"' ; string that a line must begin with *WS Sensitive*
@@ -1001,9 +1005,12 @@ Section "Uninstall"
 	
 	;remove the $APPDATA\GRASS7 folder
 	;disabled, don't remove user settings
-	;SetShellVarContext current
-	;RMDir /r "$APPDATA\GRASS7"
-
+	SetShellVarContext current
+	;RMDir /r "$APPDATA\GRASS7"	
+	${If} ${FileExists} "$APPDATA\GRASS7\addons\*.*"
+	      RMDir /r "$APPDATA\GRASS7\addons"
+	${EndIf}
+	
 	;remove the Registry Entries
 	DeleteRegKey HKLM "Software\${GRASS_BASE}"
 	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}"