Skip to content

Commit

Permalink
deleteShapeFile(): delete also ".cpg", ".sbn", ".sbx", ".idm", ".ind"…
Browse files Browse the repository at this point in the history
… 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 31, 2019
1 parent b141349 commit 70f3bd7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/core/auto_generated/qgsvectorfilewriter.sip.in
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorfilewriter.cpp
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorfilewriter.h
Expand Up @@ -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
*/
Expand Down

0 comments on commit 70f3bd7

Please sign in to comment.