@@ -39,7 +39,7 @@ QgsGrassLocationItem::~QgsGrassLocationItem() {}
39
39
bool QgsGrassLocationItem::isLocation ( QString path )
40
40
{
41
41
// QgsDebugMsg( "path = " + path );
42
- return QFile::exists ( path + QDir::separator () + " PERMANENT" + QDir::separator () + " DEFAULT_WIND" );
42
+ return QFile::exists ( path + " / " + " PERMANENT" + " / " + " DEFAULT_WIND" );
43
43
}
44
44
45
45
QVector<QgsDataItem*>QgsGrassLocationItem::createChildren ()
@@ -55,7 +55,7 @@ QVector<QgsDataItem*>QgsGrassLocationItem::createChildren()
55
55
56
56
if ( QgsGrassMapsetItem::isMapset ( path ) )
57
57
{
58
- QgsGrassMapsetItem * mapset = new QgsGrassMapsetItem ( this , path, mPath + QDir::separator () + name );
58
+ QgsGrassMapsetItem * mapset = new QgsGrassMapsetItem ( this , path, mPath + " / " + name );
59
59
mapsets.append ( mapset );
60
60
}
61
61
}
@@ -79,7 +79,7 @@ QgsGrassMapsetItem::~QgsGrassMapsetItem() {}
79
79
80
80
bool QgsGrassMapsetItem::isMapset ( QString path )
81
81
{
82
- return QFile::exists ( path + QDir::separator () + " WIND" );
82
+ return QFile::exists ( path + " / WIND" );
83
83
}
84
84
85
85
QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren ()
@@ -94,7 +94,7 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
94
94
{
95
95
QStringList layerNames = QgsGrass::vectorLayers ( mGisdbase , mLocation , mName , name );
96
96
97
- QString mapPath = mPath + QDir::separator () + " vector" + QDir::separator () + name;
97
+ QString mapPath = mPath + " / vector/ " + name;
98
98
99
99
QgsDataCollectionItem *map = 0 ;
100
100
if ( layerNames.size () > 1 )
@@ -104,7 +104,9 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
104
104
}
105
105
foreach ( QString layerName, layerNames )
106
106
{
107
- QString uri = mDirPath + QDir::separator () + name + QDir::separator () + layerName;
107
+ // don't use QDir::separator(), windows work with '/' and backslash may be lost if
108
+ // somewhere not properly escaped (there was bug in QgsMimeDataUtils for example)
109
+ QString uri = mDirPath + " /" + name + " /" + layerName;
108
110
QgsLayerItem::LayerType layerType = QgsLayerItem::Vector;
109
111
QString typeName = layerName.split ( " _" )[1 ];
110
112
QString baseLayerName = layerName.split ( " _" )[0 ];
@@ -116,7 +118,7 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
116
118
else if ( typeName == " polygon" )
117
119
layerType = QgsLayerItem::Polygon;
118
120
119
- QString layerPath = mapPath + QDir::separator () + layerName;
121
+ QString layerPath = mapPath + " / " + layerName;
120
122
if ( !map )
121
123
{
122
124
/* This may happen (one layer only) in GRASS 7 with points (no topo layers) */
@@ -141,8 +143,8 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
141
143
142
144
foreach ( QString name, rasterNames )
143
145
{
144
- QString path = mPath + QDir::separator () + " raster" + QDir::separator () + name;
145
- QString uri = mDirPath + QDir::separator () + " cellhd" + QDir::separator () + name;
146
+ QString path = mPath + " / " + " raster" + " / " + name;
147
+ QString uri = mDirPath + " / " + " cellhd" + " / " + name;
146
148
QgsDebugMsg ( " uri = " + uri );
147
149
148
150
QgsLayerItem *layer = new QgsLayerItem ( this , name, path, uri, QgsLayerItem::Raster, " grassraster" );
@@ -188,7 +190,7 @@ QGISEXTERN QgsDataItem * dataItem( QString theDirPath, QgsDataItem* parentItem )
188
190
dir.cdUp ();
189
191
path = dir.path ();
190
192
}
191
- path = path + QDir::separator () + " grass:" + dirName;
193
+ path = path + " / " + " grass:" + dirName;
192
194
QgsGrassLocationItem * location = new QgsGrassLocationItem ( parentItem, theDirPath, path );
193
195
return location;
194
196
}
0 commit comments