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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user