Fixed: Convert .bank filenames with / and use existing CFile::fileExists
This commit is contained in:
parent
50c796236b
commit
9ab71b6c27
1 changed files with 6 additions and 16 deletions
|
@ -50,16 +50,6 @@ bool recompute (const char* f1, const char* f2)
|
||||||
return buf1.st_mtime > buf2.st_mtime;
|
return buf1.st_mtime > buf2.st_mtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true if the file exist
|
|
||||||
bool isFileExist (const char* sName)
|
|
||||||
{
|
|
||||||
FILE *pFile=fopen (sName, "rb");
|
|
||||||
if (!pFile)
|
|
||||||
return false;
|
|
||||||
fclose (pFile);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill tile far pixel with this bitmap
|
// Fill tile far pixel with this bitmap
|
||||||
bool fillTileFar (uint tile, const char* sName, CTileFarBank::TFarType type, CTileFarBank& farBank, bool _256, uint8 rotate)
|
bool fillTileFar (uint tile, const char* sName, CTileFarBank::TFarType type, CTileFarBank& farBank, bool _256, uint8 rotate)
|
||||||
{
|
{
|
||||||
|
@ -287,8 +277,8 @@ int main (int argc, char **argv)
|
||||||
if (pTile->getRelativeFileName (CTile::diffuse)!="")
|
if (pTile->getRelativeFileName (CTile::diffuse)!="")
|
||||||
{
|
{
|
||||||
// File exist ?
|
// File exist ?
|
||||||
string tileFilename = bank.getAbsPath()+pTile->getRelativeFileName (CTile::diffuse);
|
string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::diffuse), false);
|
||||||
if (isFileExist (tileFilename.c_str()))
|
if (CFile::fileExists(tileFilename))
|
||||||
{
|
{
|
||||||
// Recompute it?
|
// Recompute it?
|
||||||
if (recompute (tileFilename.c_str(), argv[2])||forceRecomputation)
|
if (recompute (tileFilename.c_str(), argv[2])||forceRecomputation)
|
||||||
|
@ -318,8 +308,8 @@ int main (int argc, char **argv)
|
||||||
if (pTile->getRelativeFileName (CTile::additive)!="")
|
if (pTile->getRelativeFileName (CTile::additive)!="")
|
||||||
{
|
{
|
||||||
// File exist ?
|
// File exist ?
|
||||||
string tileFilename = bank.getAbsPath()+pTile->getRelativeFileName (CTile::additive);
|
string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::additive), false);
|
||||||
if (isFileExist (tileFilename.c_str()))
|
if (CFile::fileExists(tileFilename))
|
||||||
{
|
{
|
||||||
// Recompute it?
|
// Recompute it?
|
||||||
if (recompute (tileFilename.c_str(), argv[2])||forceRecomputation)
|
if (recompute (tileFilename.c_str(), argv[2])||forceRecomputation)
|
||||||
|
@ -349,8 +339,8 @@ int main (int argc, char **argv)
|
||||||
if (pTile->getRelativeFileName (CTile::alpha)!="")
|
if (pTile->getRelativeFileName (CTile::alpha)!="")
|
||||||
{
|
{
|
||||||
// File exist ?
|
// File exist ?
|
||||||
string tileFilename = bank.getAbsPath()+pTile->getRelativeFileName (CTile::alpha);
|
string tileFilename = bank.getAbsPath()+CPath::standardizePath(pTile->getRelativeFileName (CTile::alpha), false);
|
||||||
if (isFileExist (tileFilename.c_str()))
|
if (CFile::fileExists(tileFilename))
|
||||||
{
|
{
|
||||||
// Recompute it?
|
// Recompute it?
|
||||||
if (recompute (tileFilename.c_str(), argv[2])||forceRecomputation)
|
if (recompute (tileFilename.c_str(), argv[2])||forceRecomputation)
|
||||||
|
|
Loading…
Reference in a new issue