1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
// fgdelaction.cc
#include "fgdelaction.h"
#ifndef _FGFSHELP_H
#include "fgfshelp.h"
#endif
#ifndef _FGSTRING_H
#include "fgstring.h"
#endif
#ifndef _FGEXC_H
#include "fgexc.h"
#endif
FGDeleteAction::FGDeleteAction(const FGString& fname,
const FGString& localDir)
: mFileName(fname), mLocalDir(localDir)
{
}
FGDeleteAction::~FGDeleteAction()
{
}
void
FGDeleteAction::VirtualDo(void) const
{
// Just nuke the file
FGString file = mLocalDir;
file += '/';
file += mFileName;
// If we get a "not found" exception, ignore it
// This is because if something else deletes it, we don't care. We
// only care that the file is _gone_ :)
// I introduced this because two threads can race such that two of
// them notice the same file needs wasting
try {
FGFileSystemHelper::DeleteFile(file);
}
catch (FGException& e) {
if (e.GetReason() != FGException::kLocalNoSuchFile) {
throw;
}
}
}
void
FGDeleteAction::Abort(void) const
{
}
|