@@ -63,7 +63,6 @@ void QgsGrass::init( void )
63
63
// Set program name
64
64
G_set_program_name (" QGIS" );
65
65
66
-
67
66
// Require GISBASE to be set. This should point to the location of
68
67
// the GRASS installation. The GRASS libraries use it to know
69
68
// where to look for things.
@@ -86,6 +85,9 @@ void QgsGrass::init( void )
86
85
}
87
86
88
87
if ( !isValidGrassBaseDir (gisBase) ) {
88
+ // Erase gisbase from settings because it does not exists
89
+ settings.writeEntry (" /GRASS/gisbase" , " " );
90
+
89
91
#ifdef WIN32
90
92
// Use the applicationDirPath()/grass
91
93
gisBase = QCoreApplication::applicationDirPath () + " /grass" ;
@@ -103,21 +105,29 @@ void QgsGrass::init( void )
103
105
#endif
104
106
}
105
107
108
+ bool userGisbase = false ;
106
109
while ( !isValidGrassBaseDir (gisBase) ) {
107
110
// Keep asking user for GISBASE until we get a valid one
108
111
// QMessageBox::warning( 0, "Warning", "QGIS can't find your GRASS installation,\nGRASS data "
109
112
// "cannot be used.\nPlease select your GISBASE.\nGISBASE is full path to the\n"
110
113
// "directory where GRASS is installed." );
111
114
// XXX Need to subclass this and add explantory message above to left side
115
+ userGisbase = true ;
112
116
gisBase = QFileDialog::getExistingDirectory (
113
117
0 , " Choose GISBASE ..." , gisBase);
114
118
if (gisBase == QString::null)
115
119
{
116
120
// User pressed cancel. No GRASS for you!
117
- return ;
121
+ userGisbase = false ;
122
+ break ;
118
123
}
119
124
}
120
125
126
+ if ( userGisbase )
127
+ {
128
+ settings.writeEntry (" /GRASS/gisbase" , gisBase);
129
+ }
130
+
121
131
#ifdef QGISDEBUG
122
132
qDebug ( " %s:%d Valid GRASS gisBase is: %s" , __FILE__, __LINE__, (const char *)gisBase );
123
133
#endif
@@ -126,7 +136,6 @@ void QgsGrass::init( void )
126
136
char *gisBaseEnvChar = new char [gisBaseEnv.length ()+1 ];
127
137
strcpy ( gisBaseEnvChar, const_cast <char *>(gisBaseEnv.ascii ()) );
128
138
putenv ( gisBaseEnvChar );
129
- settings.writeEntry (" /GRASS/gisbase" , gisBase);
130
139
131
140
// Add path to GRASS modules
132
141
#ifdef WIN32
0 commit comments