mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-15 14:08:42 +00:00
Changed: Added getBigFileName method to CBigFile
This commit is contained in:
parent
3b50cfdba3
commit
b8eeb26ba3
2 changed files with 20 additions and 4 deletions
|
@ -58,7 +58,10 @@ public:
|
||||||
void remove (const std::string &sBigFileName);
|
void remove (const std::string &sBigFileName);
|
||||||
|
|
||||||
// true if a bigFile is added
|
// true if a bigFile is added
|
||||||
bool isBigFileAdded(const std::string &sBigFileName);
|
bool isBigFileAdded(const std::string &sBigFileName) const;
|
||||||
|
|
||||||
|
// return name of Big File
|
||||||
|
std::string getBigFileName(const std::string &sBigFileName) const;
|
||||||
|
|
||||||
// List all files in a bigfile
|
// List all files in a bigfile
|
||||||
void list (const std::string &sBigFileName, std::vector<std::string> &vAllFiles);
|
void list (const std::string &sBigFileName, std::vector<std::string> &vAllFiles);
|
||||||
|
|
|
@ -295,13 +295,25 @@ void CBigFile::remove (const std::string &sBigFileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
bool CBigFile::isBigFileAdded(const std::string &sBigFileName)
|
bool CBigFile::isBigFileAdded(const std::string &sBigFileName) const
|
||||||
{
|
{
|
||||||
// Is already the same bigfile name ?
|
// Is already the same bigfile name ?
|
||||||
string bigfilenamealone = CFile::getFilename (sBigFileName);
|
string bigfilenamealone = CFile::getFilename (sBigFileName);
|
||||||
return _BNPs.find(bigfilenamealone) != _BNPs.end();
|
return _BNPs.find(bigfilenamealone) != _BNPs.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
std::string CBigFile::getBigFileName(const std::string &sBigFileName) const
|
||||||
|
{
|
||||||
|
string bigfilenamealone = CFile::getFilename (sBigFileName);
|
||||||
|
map<string, BNP>::const_iterator it = _BNPs.find(bigfilenamealone);
|
||||||
|
if (it != _BNPs.end())
|
||||||
|
return it->second.BigFileName;
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void CBigFile::list (const std::string &sBigFileName, std::vector<std::string> &vAllFiles)
|
void CBigFile::list (const std::string &sBigFileName, std::vector<std::string> &vAllFiles)
|
||||||
{
|
{
|
||||||
|
@ -403,9 +415,10 @@ FILE* CBigFile::getFile (const std::string &sFileName, uint32 &rFileSize,
|
||||||
{
|
{
|
||||||
handle.File = fopen (bnp->BigFileName.c_str(), "rb");
|
handle.File = fopen (bnp->BigFileName.c_str(), "rb");
|
||||||
if (handle.File == NULL)
|
if (handle.File == NULL)
|
||||||
nlwarning ("bnp: can't fopen big file '%s' error %d '%s'", bnp->BigFileName.c_str(), errno, strerror(errno));
|
{
|
||||||
if (handle.File == NULL)
|
nlwarning ("bnp: can't fopen big file '%s' error %d '%s'", bnp->BigFileName.c_str(), errno, strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rCacheFileOnOpen = bnp->CacheFileOnOpen;
|
rCacheFileOnOpen = bnp->CacheFileOnOpen;
|
||||||
|
|
Loading…
Reference in a new issue