mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 13:01:42 +00:00
Fixed: Display an error if adding more than once the same filename in BNP
This commit is contained in:
parent
d06bff716f
commit
be0355c570
1 changed files with 13 additions and 3 deletions
|
@ -92,22 +92,32 @@ void packSubRecurse(const std::string &srcDirectory)
|
|||
printf ("Treating directory: %s\n", srcDirectory.c_str());
|
||||
CPath::getPathContent(srcDirectory, true, false, true, pathContent);
|
||||
|
||||
// TODO: remove duplicate files
|
||||
if (pathContent.empty()) return;
|
||||
|
||||
// Sort filename
|
||||
sort (pathContent.begin(), pathContent.end(), i_comp);
|
||||
|
||||
// check for files with same name
|
||||
for(uint i = 1, len = pathContent.size(); i < len; ++i)
|
||||
{
|
||||
if (toLower(CFile::getFilename(pathContent[i-1])) == toLower(CFile::getFilename(pathContent[i])))
|
||||
{
|
||||
nlerror("File %s is not unique in BNP!", CFile::getFilename(pathContent[i]).c_str());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint i=0; i<pathContent.size(); ++i)
|
||||
{
|
||||
if (keepFile(pathContent[i]))
|
||||
{
|
||||
if (gBNPHeader.appendFile(pathContent[i]))
|
||||
{
|
||||
printf("adding %s\n", pathContent[i].c_str());
|
||||
printf("Adding %s\n", pathContent[i].c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("error cannot open %s\n", pathContent[i].c_str());
|
||||
printf("Error: cannot open %s\n", pathContent[i].c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue