From d053aca537809c06f174afff80ef41c6dd5ca827 Mon Sep 17 00:00:00 2001
From: Dmitrij Naumov <dmitrij@naumov.de>
Date: Wed, 31 Oct 2012 14:03:42 +0100
Subject: [PATCH] Use extractBaseName() instead of getFileNameFromPath().

Replace getFileNameFromPath(f, true/false) with corresponding extractBaseName() and extractBaseNameWithoutExtension().
---
 BaseLib/FileTools.cpp                             | 2 +-
 FileIO/GMSInterface.cpp                           | 2 +-
 FileIO/Legacy/MeshIO.cpp                          | 2 +-
 FileIO/Legacy/OGSIOVer4.cpp                       | 2 +-
 FileIO/MeshIO/GMSHInterface.cpp                   | 2 +-
 FileIO/RapidXmlIO/RapidVtuInterface.cpp           | 2 +-
 Utils/FileConverter/generateMatPropsFromMatID.cpp | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/BaseLib/FileTools.cpp b/BaseLib/FileTools.cpp
index 22dbb223463..99454bea783 100644
--- a/BaseLib/FileTools.cpp
+++ b/BaseLib/FileTools.cpp
@@ -92,7 +92,7 @@ std::string extractBaseNameWithoutExtension(std::string const& pathname)
 
 std::string getSuffixFromPath(const std::string &path)
 {
-	const std::string str = getFileNameFromPath(path, true);
+	const std::string str = extractBaseName(path);
 	std::string::size_type beg(str.find_last_of('.'));
 	if (beg == std::string::npos)
 		return std::string();
diff --git a/FileIO/GMSInterface.cpp b/FileIO/GMSInterface.cpp
index 0a100dc0fb5..3559d4d1ba3 100644
--- a/FileIO/GMSInterface.cpp
+++ b/FileIO/GMSInterface.cpp
@@ -328,6 +328,6 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(std::string filename)
 	in.close();
 	std::cout << "finished" << std::endl;
 
-	std::string mesh_name (BaseLib::getFileNameFromPath(filename, false));
+	const std::string mesh_name = BaseLib::extractBaseNameWithoutExtension(filename);
 	return new MeshLib::Mesh(mesh_name, nodes, elements);
 }
diff --git a/FileIO/Legacy/MeshIO.cpp b/FileIO/Legacy/MeshIO.cpp
index 6c20b1b12cd..ca866900e23 100644
--- a/FileIO/Legacy/MeshIO.cpp
+++ b/FileIO/Legacy/MeshIO.cpp
@@ -107,7 +107,7 @@ MeshLib::Mesh* MeshIO::loadMeshFromFile(const std::string& file_name)
 		}
 
 
-		MeshLib::Mesh* mesh (new MeshLib::Mesh(BaseLib::getFileNameFromPath(file_name, false), nodes, elements));
+		MeshLib::Mesh* mesh (new MeshLib::Mesh(BaseLib::extractBaseNameWithoutExtension(file_name), nodes, elements));
 		mesh->setEdgeLengthRange(sqrt(edge_length[0]), sqrt(edge_length[1]));
 
 		std::cout << "finished." << std::endl;
diff --git a/FileIO/Legacy/OGSIOVer4.cpp b/FileIO/Legacy/OGSIOVer4.cpp
index b410427378f..3f9332e415d 100644
--- a/FileIO/Legacy/OGSIOVer4.cpp
+++ b/FileIO/Legacy/OGSIOVer4.cpp
@@ -551,7 +551,7 @@ bool readGLIFileV4(const std::string& fname, GEOObjects* geo, std::string& uniqu
 	tag = readPoints(in, pnt_vec, zero_based_idx, pnt_id_names_map);
 	std::cout << " ok, " << pnt_vec->size() << " points read" << std::endl;
 
-	unique_name = BaseLib::getFileNameFromPath(fname, true);
+	unique_name = BaseLib::extractBaseName(fname);
 	if (!pnt_vec->empty())
 		geo->addPointVec(pnt_vec, unique_name, pnt_id_names_map);  // KR: insert into GEOObjects if not empty
 
diff --git a/FileIO/MeshIO/GMSHInterface.cpp b/FileIO/MeshIO/GMSHInterface.cpp
index 3aa6e5cad64..9ab147541f9 100644
--- a/FileIO/MeshIO/GMSHInterface.cpp
+++ b/FileIO/MeshIO/GMSHInterface.cpp
@@ -211,7 +211,7 @@ MeshLib::Mesh* GMSHInterface::readGMSHMesh(std::string const& fname)
 		}
 	}
 	in.close();
-	return new MeshLib::Mesh(BaseLib::getFileNameFromPath(fname, false), nodes, elements);
+	return new MeshLib::Mesh(BaseLib::extractBaseNameWithoutExtension(fname), nodes, elements);
 }
 
 void GMSHInterface::readNodeIDs(std::ifstream &in, unsigned n_nodes, std::vector<unsigned> &node_ids, std::map<unsigned, unsigned> &id_map)
diff --git a/FileIO/RapidXmlIO/RapidVtuInterface.cpp b/FileIO/RapidXmlIO/RapidVtuInterface.cpp
index 65738ea028f..154452a6d89 100644
--- a/FileIO/RapidXmlIO/RapidVtuInterface.cpp
+++ b/FileIO/RapidXmlIO/RapidVtuInterface.cpp
@@ -178,7 +178,7 @@ MeshLib::Mesh* RapidVtuInterface::readVTUFile(const std::string &file_name)
 			std::cout << "Nr. Nodes: " << nodes.size() << std::endl;
 			std::cout << "Nr. Elements: " << elements.size() << std::endl;
 			delete [] buffer;
-			return new MeshLib::Mesh(BaseLib::getFileNameFromPath(file_name, false), nodes, elements);
+			return new MeshLib::Mesh(BaseLib::extractBaseNameWithoutExtension(file_name), nodes, elements);
 		}
 		else {
 			std::cout << "Error in RapidVtuInterface::readVTUFile() - Number of nodes and elements not specified." << std::endl;
diff --git a/Utils/FileConverter/generateMatPropsFromMatID.cpp b/Utils/FileConverter/generateMatPropsFromMatID.cpp
index 9a9aec192ef..d5b475f37bb 100644
--- a/Utils/FileConverter/generateMatPropsFromMatID.cpp
+++ b/Utils/FileConverter/generateMatPropsFromMatID.cpp
@@ -28,7 +28,7 @@ int main (int argc, char* argv[])
 
 	// create file
 	std::string filename(argv[1]);
-	std::string name(BaseLib::getFileNameFromPath(filename, false));
+	std::string name = BaseLib::extractBaseNameWithoutExtension(filename);
 
 	std::string new_matname(name + "_prop");
 	std::ofstream out_prop( new_matname.c_str(), std::ios::out );
-- 
GitLab