File: deprecated-boost-filesystem-extension.patch

package info (click to toggle)
dolfin 2019.2.0~legacy20240219.1c52e83-25
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 32,016 kB
  • sloc: xml: 104,040; cpp: 102,227; python: 24,356; sh: 472; makefile: 332; javascript: 226
file content (43 lines) | stat: -rw-r--r-- 1,720 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
diff --git a/dolfin/io/File.cpp b/dolfin/io/File.cpp
index 7ad5a7422..bc748a4b5 100644
--- a/dolfin/io/File.cpp
+++ b/dolfin/io/File.cpp
@@ -147,14 +147,13 @@ void File::init(MPI_Comm comm, const std::string filename,

   // Get file path and extension
   const boost::filesystem::path path(filename);
-  const std::string extension = boost::filesystem::extension(path);
+  const std::string extension = path.extension().string();

   // Choose format based on extension
   if (extension == ".gz")
   {
     // Get suffix after discarding .gz
-    const std::string ext =
-      boost::filesystem::extension(boost::filesystem::basename(path));
+    const std::string ext = path.stem().extension().string();
     if (ext == ".xml")
       _file.reset(new XMLFile(comm, filename));
     else
diff --git a/dolfin/io/XMLFile.cpp b/dolfin/io/XMLFile.cpp
index 4c62f7b84..023f6a1d9 100644
--- a/dolfin/io/XMLFile.cpp
+++ b/dolfin/io/XMLFile.cpp
@@ -400,7 +400,7 @@ void XMLFile::load_xml_doc(pugi::xml_document& xml_doc) const

   // Get file path and extension
   const boost::filesystem::path path(_filename);
-  const std::string extension = boost::filesystem::extension(path);
+  const std::string extension = path.extension().string();

   // Check that file exists
   if (!boost::filesystem::is_regular_file(_filename))
@@ -464,7 +464,7 @@ void XMLFile::save_xml_doc(const pugi::xml_document& xml_doc) const
   {
     // Compress if filename has extension '.gz'
     const boost::filesystem::path path(_filename);
-    const std::string extension = boost::filesystem::extension(path);
+    const std::string extension = path.extension().string();
     if (extension == ".gz")
     {
       std::stringstream xml_stream;