From fc31e417b9de8427bc1048a07c66e41e1b520652 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 1 Sep 2010 21:46:39 +0200 Subject: [PATCH] Fixed: warning when destination file doesn'texist --- code/nel/tools/3d/tga_2_dds/tga2dds.cpp | 33 ++++++++++++------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/code/nel/tools/3d/tga_2_dds/tga2dds.cpp b/code/nel/tools/3d/tga_2_dds/tga2dds.cpp index 41a0ca9f6..4328c48fb 100644 --- a/code/nel/tools/3d/tga_2_dds/tga2dds.cpp +++ b/code/nel/tools/3d/tga_2_dds/tga2dds.cpp @@ -37,18 +37,18 @@ using namespace std; #define NOT_DEFINED 0xff -bool sameType(const char *sFileNameDest, uint8 algo); -bool dataCheck(const char *sFileNameSrc, const char *sFileNameDest, uint8 algo); +bool sameType(const std::string &sFileNameDest, uint8 algo); +bool dataCheck(const std::string &sFileNameSrc, const std::string &FileNameDest, uint8 algo); std::string getOutputFileName(const std::string &inputFileName); void writeInstructions(); -uint8 getType(const char *sFileNameDest) +uint8 getType(const std::string &sFileNameDest) { uint32 dds; - FILE *f = fopen(sFileNameDest,"rb"); + FILE *f = fopen(sFileNameDest.c_str(),"rb"); if(f==NULL) { return NOT_DEFINED; @@ -97,10 +97,10 @@ uint8 getType(const char *sFileNameDest) return NOT_DEFINED; } -bool sameType(const char *sFileNameDest, uint8 &algo, bool wantMipMap) +bool sameType(const std::string &sFileNameDest, uint8 &algo, bool wantMipMap) { uint32 dds; - FILE *f = fopen(sFileNameDest,"rb"); + FILE *f = fopen(sFileNameDest.c_str(),"rb"); if(f==NULL) { return false; @@ -163,23 +163,22 @@ bool sameType(const char *sFileNameDest, uint8 &algo, bool wantMipMap) -bool dataCheck(const char *sFileNameSrc, const char *sFileNameDest, uint8& algo, bool wantMipMap) +bool dataCheck(const std::string &sFileNameSrc, const std::string &sFileNameDest, uint8& algo, bool wantMipMap) { - uint32 lastWriteTime1 = CFile::getFileModificationDate(sFileNameSrc); - - if (!lastWriteTime1) + if (!CFile::fileExists(sFileNameSrc)) { - cerr<<"Can't open file "< lastWriteTime2) { return false; @@ -430,7 +429,7 @@ int main(int argc, char **argv) // Check dest algo if (OptAlgo==NOT_DEFINED) - OptAlgo = getType (outputFileName.c_str()); + OptAlgo = getType (outputFileName); // Choose Algo. if(OptAlgo!=NOT_DEFINED) @@ -447,7 +446,7 @@ int main(int argc, char **argv) // Data check //=========== - if(dataCheck(inputFileName.c_str(),outputFileName.c_str(), OptAlgo, OptMipMap)) + if(dataCheck(inputFileName,outputFileName, OptAlgo, OptMipMap)) { cout<