Commit fa2b52bf authored by Guillaume Pasero's avatar Guillaume Pasero

ENH: cleaning files linked to a shapefile

parent a568fac6
......@@ -56,6 +56,17 @@ bool RemoveFile(std::string &filePath)
bool res = true;
if(itksys::SystemTools::FileExists(filePath.c_str()))
{
size_t posExt = filePath.rfind('.');
if (posExt != std::string::npos &&
filePath.compare(posExt,std::string::npos,".shp") == 0)
{
std::string shxPath = filePath.substr(0,posExt) + std::string(".shx");
std::string dbfPath = filePath.substr(0,posExt) + std::string(".dbf");
std::string prjPath = filePath.substr(0,posExt) + std::string(".prj");
RemoveFile(shxPath);
RemoveFile(dbfPath);
RemoveFile(prjPath);
}
res = itksys::SystemTools::RemoveFile(filePath.c_str());
if (!res)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment