add better testing for unlink
This commit is contained in:
parent
9676bb4b22
commit
62b612fbf8
|
@ -15,7 +15,6 @@
|
||||||
|
|
||||||
=========================================================================*/
|
=========================================================================*/
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "errno.h"
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "cmRegularExpression.h"
|
#include "cmRegularExpression.h"
|
||||||
|
@ -1166,6 +1165,15 @@ long int cmSystemTools::ModifiedTime(const char* filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void cmSystemTools::ReportLastSystemError(const char* msg)
|
||||||
|
{
|
||||||
|
int e = errno;
|
||||||
|
std::string m = msg;
|
||||||
|
m += ": System Error: ";
|
||||||
|
m += strerror(e);
|
||||||
|
cmSystemTools::Error(m.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool cmSystemTools::RemoveFile(const char* source)
|
bool cmSystemTools::RemoveFile(const char* source)
|
||||||
{
|
{
|
||||||
|
|
|
@ -353,6 +353,10 @@ public:
|
||||||
*/
|
*/
|
||||||
static void SetRunCommandHideConsole(bool v){s_RunCommandHideConsole = v;}
|
static void SetRunCommandHideConsole(bool v){s_RunCommandHideConsole = v;}
|
||||||
static bool GetRunCommandHideConsole(){ return s_RunCommandHideConsole;}
|
static bool GetRunCommandHideConsole(){ return s_RunCommandHideConsole;}
|
||||||
|
/** Call cmSystemTools::Error with the message m, plus the
|
||||||
|
* result of strerror(errno)
|
||||||
|
*/
|
||||||
|
static void ReportLastSystemError(const char* m);
|
||||||
|
|
||||||
/** When building DEBUG with MSVC, this enables a hook that prevents
|
/** When building DEBUG with MSVC, this enables a hook that prevents
|
||||||
* error dialogs from popping up if the program is being run from
|
* error dialogs from popping up if the program is being run from
|
||||||
|
|
|
@ -280,7 +280,12 @@ void cmTryCompileCommand::CleanupFiles(const char* binDir)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmSystemTools::RemoveFile(fullPath.c_str());
|
if(!cmSystemTools::RemoveFile(fullPath.c_str()))
|
||||||
|
{
|
||||||
|
std::string m = "Remove failed on file: ";
|
||||||
|
m += fullPath;
|
||||||
|
cmSystemTools::ReportLastSystemError(m.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue