File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -894,7 +894,10 @@ void QgsGrassMapcalc::updateMaps()
894
894
// Check if it is GRASS raster
895
895
QString source = QDir::cleanDirPath ( layer->source () );
896
896
897
- QChar sep = QDir::separator ();
897
+ // Note: QDir::cleanPath is using '/' also on Windows
898
+ // QChar sep = QDir::separator();
899
+ QChar sep = ' /' ;
900
+
898
901
if ( source.contains ( " cellhd" ) == 0 ) continue ;
899
902
900
903
// Most probably GRASS layer, check GISBASE and LOCATION
@@ -910,8 +913,11 @@ void QgsGrassMapcalc::updateMaps()
910
913
QString mapset = split.last ();
911
914
split.pop_back (); // mapset
912
915
913
- QDir locDir ( sep + split.join ( QString (sep) ) ) ;
914
- QString loc = locDir.canonicalPath ();
916
+ // QDir locDir ( sep + split.join ( QString(sep) ) ) ;
917
+ // QString loc = locDir.canonicalPath();
918
+
919
+ QString loc = source.remove ( QRegExp (" /[^/]+/[^/]+/[^/]+$" ) );
920
+ loc = QDir (loc).canonicalPath ();
915
921
916
922
QDir curlocDir ( QgsGrass::getDefaultGisdbase () + sep + QgsGrass::getDefaultLocation () );
917
923
QString curloc = curlocDir.canonicalPath ();
You can’t perform that action at this time.
0 commit comments