ENH: add some better output when copy file fails

This commit is contained in:
Bill Hoffman 2002-11-19 14:40:47 -05:00
parent fd30c82a19
commit 76fca308d3
1 changed files with 15 additions and 5 deletions

View File

@ -22,6 +22,8 @@
#include <ctype.h> #include <ctype.h>
#include "cmDirectory.h" #include "cmDirectory.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include <errno.h>
// support for realpath call // support for realpath call
#ifndef _WIN32 #ifndef _WIN32
@ -1203,9 +1205,13 @@ void cmSystemTools::cmCopyFile(const char* source,
std::ifstream fin(source); std::ifstream fin(source);
#endif #endif
if(!fin) if(!fin)
{ {
cmSystemTools::Error("CopyFile failed to open input file \"", std::string m = "CopyFile failed to open input file \"";
source, "\""); m += source;
m += "\"";
m += " System Error: ";
m += strerror(errno);
cmSystemTools::Error(m.c_str());
return; return;
} }
@ -1218,8 +1224,12 @@ void cmSystemTools::cmCopyFile(const char* source,
#endif #endif
if(!fout) if(!fout)
{ {
cmSystemTools::Error("CopyFile failed to open output file \"", std::string m = "CopyFile failed to open output file \"";
destination, "\""); m += destination;
m += "\"";
m += " System Error: ";
m += strerror(errno);
cmSystemTools::Error(m.c_str());
return; return;
} }