From 1dd429ac358a928eba56f5e54ab86ccf450fbc61 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Fri, 18 May 2007 02:45:08 +0000 Subject: [PATCH] Change return type of PBD::copy_file to boolean to indicate success/failure git-svn-id: svn://localhost/ardour2/trunk@1866 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/pbd/copyfile.cc | 10 +++++----- libs/pbd/pbd/copyfile.h | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/libs/pbd/copyfile.cc b/libs/pbd/copyfile.cc index 2284a6b26d..b4a654dbe8 100644 --- a/libs/pbd/copyfile.cc +++ b/libs/pbd/copyfile.cc @@ -29,7 +29,7 @@ using namespace PBD; using namespace std; -int +bool PBD::copy_file (Glib::ustring from, Glib::ustring to) { ifstream in (from.c_str()); @@ -37,12 +37,12 @@ PBD::copy_file (Glib::ustring from, Glib::ustring to) if (!in) { error << string_compose (_("Could not open %1 for copy"), from) << endmsg; - return -1; + return false; } if (!out) { error << string_compose (_("Could not open %1 as copy"), to) << endmsg; - return -1; + return false; } out << in.rdbuf(); @@ -50,8 +50,8 @@ PBD::copy_file (Glib::ustring from, Glib::ustring to) if (!in || !out) { error << string_compose (_("Could not copy existing file %1 to %2"), from, to) << endmsg; unlink (to.c_str()); - return -1; + return false; } - return 0; + return true; } diff --git a/libs/pbd/pbd/copyfile.h b/libs/pbd/pbd/copyfile.h index 1e8c5c2a42..f233d68d87 100644 --- a/libs/pbd/pbd/copyfile.h +++ b/libs/pbd/pbd/copyfile.h @@ -21,5 +21,8 @@ namespace PBD { - int copy_file (Glib::ustring from, Glib::ustring to); + /** + * @return true if file was successfully copied + */ + bool copy_file (Glib::ustring from, Glib::ustring to); }