changeset 31831:45ac4c5272e9

load-save.cc: Change rename function load-save.cc: It turns out that std::filesystem is C++17 but only works with gcc and not clang. Trying the cstdio rename function instead for greater portability.
author Arun Giridhar <arungiridhar@gmail.com>
date Wed, 15 Feb 2023 19:32:12 -0500
parents 354ed032ba50
children c82c5f7a1579
files libinterp/corefcn/load-save.cc
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/load-save.cc	Wed Feb 15 17:41:53 2023 -0500
+++ b/libinterp/corefcn/load-save.cc	Wed Feb 15 19:32:12 2023 -0500
@@ -28,8 +28,8 @@
 #endif
 
 #include <cstring>
+#include <cstdio>
 
-#include <filesystem>
 #include <fstream>
 #include <iomanip>
 #include <iostream>
@@ -1557,9 +1557,9 @@
         // that was specified.
         try
           {
-            std::filesystem::rename (fname, desiredname);
+            rename (fname.c_str (), desiredname.c_str ());
           }
-        catch (std::filesystem::filesystem_error& e)
+        catch (std::exception& e)
           {
             error ("save: unable to save to %s  %s",
                    desiredname.c_str (), e.what ());