From 15be15451592817731a271cd16d9b94c40c3023b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 15 Jul 2013 14:29:00 -0400 Subject: use g_unlink() rather than unlink() universally, requires in several files --- gtk2_ardour/editor_export_audio.cc | 6 ++++-- gtk2_ardour/editor_videotimeline.cc | 4 +++- gtk2_ardour/export_video_dialog.cc | 16 +++++++++------- gtk2_ardour/sfdb_ui.cc | 4 +++- gtk2_ardour/transcode_video_dialog.cc | 6 ++++-- 5 files changed, 23 insertions(+), 13 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/editor_export_audio.cc b/gtk2_ardour/editor_export_audio.cc index 877a39e773..e40030d671 100644 --- a/gtk2_ardour/editor_export_audio.cc +++ b/gtk2_ardour/editor_export_audio.cc @@ -25,6 +25,8 @@ #include +#include + #include "gtkmm2ext/choice.h" #include "pbd/pthread_utils.h" @@ -158,11 +160,11 @@ Editor::export_region () switch (ret) { case Gtk::RESPONSE_ACCEPT: - /* force unlink because the backend code will + /* force ::g_unlink because the backend code will go wrong if it tries to open an existing file for writing. */ - ::unlink (path.c_str()); + ::g_unlink (path.c_str()); break; default: return; diff --git a/gtk2_ardour/editor_videotimeline.cc b/gtk2_ardour/editor_videotimeline.cc index 7395d767c7..5da8a295b7 100644 --- a/gtk2_ardour/editor_videotimeline.cc +++ b/gtk2_ardour/editor_videotimeline.cc @@ -20,6 +20,8 @@ #include +#include + #include "ardour/profile.h" #include "ardour/rc_configuration.h" #include "ardour/audio_track.h" @@ -118,7 +120,7 @@ Editor::embed_audio_from_video (std::string path, framepos_t n) import_status.all_done = true; #endif - unlink(path.c_str()); + ::g_unlink(path.c_str()); } void diff --git a/gtk2_ardour/export_video_dialog.cc b/gtk2_ardour/export_video_dialog.cc index ce85fad81e..d51fd60e2b 100644 --- a/gtk2_ardour/export_video_dialog.cc +++ b/gtk2_ardour/export_video_dialog.cc @@ -30,6 +30,8 @@ #include #include +#include + #include "pbd/error.h" #include "pbd/convert.h" #include "gtkmm2ext/utils.h" @@ -405,8 +407,8 @@ void ExportVideoDialog::finished () { if (aborted) { - unlink(outfn_path_entry.get_text().c_str()); - unlink (insnd.c_str()); + ::g_unlink(outfn_path_entry.get_text().c_str()); + ::g_unlink (insnd.c_str()); Gtk::Dialog::response(RESPONSE_CANCEL); } else if (twopass && firstpass) { firstpass = false; @@ -416,9 +418,9 @@ ExportVideoDialog::finished () if (twopass_checkbox.get_active()) { std::string outfn = outfn_path_entry.get_text(); std::string p2log = Glib::path_get_dirname (outfn) + G_DIR_SEPARATOR + "ffmpeg2pass"; - unlink (p2log.c_str()); + ::g_unlink (p2log.c_str()); } - unlink (insnd.c_str()); + ::g_unlink (insnd.c_str()); Gtk::Dialog::response(RESPONSE_ACCEPT); } } @@ -554,7 +556,7 @@ ExportVideoDialog::launch_export () audio_progress_connection.disconnect(); status->finish (); if (status->aborted()) { - unlink (insnd.c_str()); + ::g_unlink (insnd.c_str()); Gtk::Dialog::response(RESPONSE_CANCEL); return; } @@ -571,14 +573,14 @@ ExportVideoDialog::encode_pass (int pass) transcoder = new TranscodeFfmpeg(invid); if (!transcoder->ffexec_ok()) { /* ffmpeg binary was not found. TranscodeFfmpeg prints a warning */ - unlink (insnd.c_str()); + ::g_unlink (insnd.c_str()); Gtk::Dialog::response(RESPONSE_CANCEL); return; } if (!transcoder->probe_ok()) { /* video input file can not be read */ warning << _("Export Video: Video input file cannot be read.") << endmsg; - unlink (insnd.c_str()); + ::g_unlink (insnd.c_str()); Gtk::Dialog::response(RESPONSE_CANCEL); return; } diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 482a3b61b7..f116041d03 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -31,6 +31,8 @@ #include #include + +#include #include #include "pbd/convert.h" @@ -1487,7 +1489,7 @@ SoundFileOmega::check_link_status (const Session* s, const vector& paths goto out; } - unlink (tmpc); + ::g_unlink (tmpc); } ret = true; diff --git a/gtk2_ardour/transcode_video_dialog.cc b/gtk2_ardour/transcode_video_dialog.cc index fa5d447a3a..4d8b9b9f11 100644 --- a/gtk2_ardour/transcode_video_dialog.cc +++ b/gtk2_ardour/transcode_video_dialog.cc @@ -30,6 +30,8 @@ #include #include +#include + #include "pbd/error.h" #include "pbd/convert.h" #include "gtkmm2ext/utils.h" @@ -301,9 +303,9 @@ void TranscodeVideoDialog::finished () { if (aborted) { - unlink(path_entry.get_text().c_str()); + ::g_unlink(path_entry.get_text().c_str()); if (!audiofile.empty()) { - unlink(audiofile.c_str()); + ::g_unlink(audiofile.c_str()); } Gtk::Dialog::response(RESPONSE_CANCEL); } else { -- cgit v1.2.3