Skip to content
Permalink
Browse files

deleteShapeFile(): delete also ".cpg", ".sbn", ".sbx", ".idm", ".ind"…

… files

Make QgsVectorFileWriter::deleteShapeFile() delete ".cpg" (and ".sbn", ".sbx", ".idm", ".ind") files along with ".shp", ".shx", ".dbf", ".prj", ".qix", ".qpj" ones.
  • Loading branch information
agiudiceandrea authored and nyalldawson committed Mar 30, 2019
1 parent b141349 commit 70f3bd7f606e54d5d980e7dbfd9d72d3eefd055f
@@ -528,7 +528,7 @@ Adds a ``feature`` to the currently opened data source, using the style from a s

static bool deleteShapeFile( const QString &fileName );
%Docstring
Delete a shapefile (and its accompanying shx / dbf / prf)
Delete a shapefile (and its accompanying shx / dbf / prj / qix / qpj / cpg / sbn / sbx / idm / ind)

:param fileName: /path/to/file.shp

@@ -2880,7 +2880,7 @@ bool QgsVectorFileWriter::deleteShapeFile( const QString &fileName )
QDir dir = fi.dir();

QStringList filter;
const char *suffixes[] = { ".shp", ".shx", ".dbf", ".prj", ".qix", ".qpj" };
const char *suffixes[] = { ".shp", ".shx", ".dbf", ".prj", ".qix", ".qpj", ".cpg", ".sbn", ".sbx", ".idm", ".ind" };
for ( std::size_t i = 0; i < sizeof( suffixes ) / sizeof( *suffixes ); i++ )
{
filter << fi.completeBaseName() + suffixes[i];
@@ -718,7 +718,7 @@ class CORE_EXPORT QgsVectorFileWriter : public QgsFeatureSink
~QgsVectorFileWriter() override;

/**
* Delete a shapefile (and its accompanying shx / dbf / prf)
* Delete a shapefile (and its accompanying shx / dbf / prj / qix / qpj / cpg / sbn / sbx / idm / ind)
* \param fileName /path/to/file.shp
* \returns bool TRUE if the file was deleted successfully
*/

0 comments on commit 70f3bd7

Please sign in to comment.
You can’t perform that action at this time.