Changed: Replaced DeleteFile (Win32) by NLMISC::CFile::deleteFile

This commit is contained in:
kervala 2010-10-16 19:05:06 +02:00
parent 30ad426e03
commit c3d577eb0e
2 changed files with 19 additions and 16 deletions

View file

@ -39,9 +39,10 @@
#include "nel/misc/i_xml.h" #include "nel/misc/i_xml.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/file.h" #include "nel/misc/file.h"
#include "nel/misc/path.h"
#include "tools.h" #include "tools.h"
#include "../master/continentcfg.h" #include "../master/ContinentCfg.h"
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
@ -50,7 +51,7 @@ using namespace NLLIGO;
using namespace NLGEORGES; using namespace NLGEORGES;
#define MAX_SYS_DIR 6 #define MAX_SYS_DIR 6
char *gExportSysDir[MAX_SYS_DIR] = const char *gExportSysDir[MAX_SYS_DIR] =
{ {
".", ".",
"..", "..",
@ -85,7 +86,7 @@ void CExport::delIGZone (sint32 x, sint32 y)
{ {
string sZoneName = CExport::getZoneNameFromXY (x, y); string sZoneName = CExport::getZoneNameFromXY (x, y);
sZoneName += ".ig"; sZoneName += ".ig";
if (DeleteFile(sZoneName.c_str())) if (CFile::deleteFile(deleteFile(sZoneName))
{ {
CTools::chdir (_ExeDir); CTools::chdir (_ExeDir);
string sTmp = string(" zone ") + sZoneName + " deleted"; string sTmp = string(" zone ") + sZoneName + " deleted";
@ -1208,7 +1209,7 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
if (!CTools::fileExist(sNewName)) if (!CTools::fileExist(sNewName))
{ {
// Delete the oldest file // Delete the oldest file
DeleteFile(vFiles[i].c_str()); CFile::deleteFile(vFiles[i]);
} }
} }
@ -1226,7 +1227,7 @@ bool CExport::newExport (SExportOptions &opt, IExportCB *expCB)
if (!CTools::fileExist(sNewName)) if (!CTools::fileExist(sNewName))
{ {
// Delete the oldest file // Delete the oldest file
DeleteFile(vFiles[i].c_str()); CFile::deleteFile(vFiles[i]);
} }
} }
} }

View file

@ -41,7 +41,9 @@
#include <memory> #include <memory>
#include <windows.h> #ifdef NL_OS_WINDOWS
# include <windows.h>
#endif // NL_OS_WINDOWS
using namespace NL3D; using namespace NL3D;
using namespace NLMISC; using namespace NLMISC;
@ -360,8 +362,8 @@ bool CExport::export_ (SExportOptions &options, IExportCB *expCB)
if (bMustDelete) if (bMustDelete)
{ {
if (!DeleteFile (allFiles[nFile].c_str())) if (!CFile::deleteFile (allFiles[nFile]))
{ {
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispWarning (string("Can't delete ") + fileName); _ExportCB->dispWarning (string("Can't delete ") + fileName);
} }
@ -844,15 +846,15 @@ void CExport::treatPattern (sint32 x, sint32 y,
{ {
// Delete the .zone and .zonel file // Delete the .zone and .zonel file
DstZoneFileName = getZoneNameFromXY(x+deltaX+i, y+deltaY+j); DstZoneFileName = getZoneNameFromXY(x+deltaX+i, y+deltaY+j);
DstZoneFileName = _Options->OutZoneDir + string("\\") + DstZoneFileName; DstZoneFileName = _Options->OutZoneDir + string("/") + DstZoneFileName;
string sTmp = DstZoneFileName + string(".zone"); string sTmp = DstZoneFileName + string(".zone");
DeleteFile (sTmp.c_str()); CFile::deleteFile (sTmp);
DstZoneFileName = DstZoneFileName + string(".zonel"); DstZoneFileName = DstZoneFileName + string(".zonel");
DeleteFile (DstZoneFileName.c_str()); CFile::deleteFile (DstZoneFileName);
// Delete the .zonenh file // Delete the .zonenh file
string DstZoneNoHeightmapFileName = _Options->OutZoneDir + string("\\") + getZoneNameFromXY(x+deltaX+i, y+deltaY+j) + string(".zonenh"); string DstZoneNoHeightmapFileName = _Options->OutZoneDir + string("/") + getZoneNameFromXY(x+deltaX+i, y+deltaY+j) + string(".zonenh");
DeleteFile (DstZoneNoHeightmapFileName.c_str()); CFile::deleteFile (DstZoneNoHeightmapFileName);
COFile outFile (DstZoneFileName); COFile outFile (DstZoneFileName);
UnitZoneLighted.serial (outFile); UnitZoneLighted.serial (outFile);
@ -876,9 +878,9 @@ void CExport::treatPattern (sint32 x, sint32 y,
try try
{ {
dstIGFileName = getZoneNameFromXY(x+deltaX+i, y+deltaY+j); dstIGFileName = getZoneNameFromXY(x+deltaX+i, y+deltaY+j);
dstIGFileName = _Options->OutIGDir + string("\\") + dstIGFileName + string(".ig"); dstIGFileName = _Options->OutIGDir + string("/") + dstIGFileName + string(".ig");
DeleteFile (dstIGFileName.c_str()); CFile::deleteFile (dstIGFileName);
COFile outFile (dstIGFileName); COFile outFile (dstIGFileName);
unitIG.serial(outFile); unitIG.serial(outFile);
if (_ExportCB != NULL) if (_ExportCB != NULL)
_ExportCB->dispInfo (string("Writing ") + getZoneNameFromXY(x+deltaX+i, y+deltaY+j) + ".ig"); _ExportCB->dispInfo (string("Writing ") + getZoneNameFromXY(x+deltaX+i, y+deltaY+j) + ".ig");