#include <sys/time.h>
#include <sys/stat.h>
-#include <stdio.h> // for rename(), sigh
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#include <glib.h>
+#include <glib/gstdio.h>
+
#include "pbd/convert.h"
#include "pbd/basename.h"
#include "pbd/stl_delete.h"
}
}
- if (::rename (_path.c_str(), newpath.c_str()) != 0) {
+ if (::g_rename (_path.c_str(), newpath.c_str()) != 0) {
PBD::error << string_compose (
_("cannot rename file source from %1 to %2 (%3)"),
_path, newpath, strerror (errno)) << endmsg;
if (move_dependents_to_trash() != 0) {
/* try to back out */
- ::rename (newpath.c_str(), _path.c_str());
+ ::g_rename (newpath.c_str(), _path.c_str());
return -1;
}
if (Glib::file_test (oldpath.c_str(), Glib::FILE_TEST_EXISTS)) {
/* rename only needed if file exists on disk */
- if (::rename (oldpath.c_str(), newpath.c_str()) != 0) {
+ if (::g_rename (oldpath.c_str(), newpath.c_str()) != 0) {
error << string_compose (_("cannot rename file %1 to %2 (%3)"), oldpath, newpath, strerror(errno)) << endmsg;
return -1;
}