- added logic to delete old texture after doing a model texture conversion

This commit is contained in:
Mark Vejvoda
2011-03-12 22:11:09 +00:00
parent c67d7d48c2
commit f35e920d47
6 changed files with 39 additions and 114 deletions

View File

@@ -356,11 +356,7 @@ void removeFolder(const string path) {
if(isdir(item.c_str()) == false) {
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] file item [%s]\n",__FILE__,__FUNCTION__,__LINE__,item.c_str());
#ifdef WIN32
int result = _unlink(item.c_str());
#else
int result = unlink(item.c_str());
#endif
bool result = removeFile(item);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] fileitem [%s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,item.c_str(),result);
}
}
@@ -485,11 +481,8 @@ void clearFolderTreeContentsCheckSum(vector<string> paths, string pathSearchStri
string crcCacheFile = getFormattedCRCCacheFileName(cacheKeys);
if(fileExists(crcCacheFile) == true) {
#ifdef WIN32
int result = _unlink(crcCacheFile.c_str());
#else
int result = unlink(crcCacheFile.c_str());
#endif
bool result = removeFile(crcCacheFile);
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] fileitem [%s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,crcCacheFile.c_str(),result);
}
}
@@ -560,11 +553,7 @@ void clearFolderTreeContentsCheckSum(const string &path, const string filterFile
}
string crcCacheFile = getFormattedCRCCacheFileName(cacheKeys);
if(fileExists(crcCacheFile) == true) {
#ifdef WIN32
int result = _unlink(crcCacheFile.c_str());
#else
int result = unlink(crcCacheFile.c_str());
#endif
bool result = removeFile(crcCacheFile.c_str());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] fileitem [%s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,crcCacheFile.c_str(),result);
}
}
@@ -722,11 +711,7 @@ void clearFolderTreeContentsCheckSumList(vector<string> paths, string pathSearch
}
string crcCacheFile = getFormattedCRCCacheFileName(cacheKeys);
if(fileExists(crcCacheFile) == true) {
#ifdef WIN32
int result = _unlink(crcCacheFile.c_str());
#else
int result = unlink(crcCacheFile.c_str());
#endif
bool result = removeFile(crcCacheFile.c_str());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] fileitem [%s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,crcCacheFile.c_str(),result);
}
}
@@ -876,11 +861,7 @@ void clearFolderTreeContentsCheckSumList(const string &path, const string filter
}
string crcCacheFile = getFormattedCRCCacheFileName(cacheKeys);
if(fileExists(crcCacheFile) == true) {
#ifdef WIN32
int result = _unlink(crcCacheFile.c_str());
#else
int result = unlink(crcCacheFile.c_str());
#endif
bool result = removeFile(crcCacheFile.c_str());
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] fileitem [%s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,crcCacheFile.c_str(),result);
}
}
@@ -1365,6 +1346,16 @@ bool executeShellCommand(string cmd) {
return result;
}
bool removeFile(string file) {
#ifdef WIN32
int result = _unlink(file.c_str());
#else
int result = unlink(file.c_str());
#endif
return (result == 0);
}
// =====================================
// ModeInfo
// =====================================

View File

@@ -72,11 +72,8 @@ static size_t my_fwrite(void *buffer, size_t size, size_t nmemb, void *stream) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Client thread CANCELLED, deleting file for writing [%s]\n",fullFilePath.c_str());
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Client thread CANCELLED, deleting file for writing [%s]\n",fullFilePath.c_str());
#ifdef WIN32
_unlink(fullFilePath.c_str());
#else
unlink(fullFilePath.c_str());
#endif
removeFile(fullFilePath);
return -1;
}
@@ -311,11 +308,7 @@ FTP_Client_ResultType FTPClientThread::getMapFromServer(string mapFileName, stri
ftpfile.stream = NULL;
}
if(result != ftp_crt_SUCCESS) {
#ifdef WIN32
_unlink(destFile.c_str());
#else
unlink(destFile.c_str());
#endif
removeFile(destFile);
}
return result;