Commit 9bd75479 authored by Michael Reeves's avatar Michael Reeves

Scrap duplicate code

Rework CVSIgnoreList::init to use addEntriesFromFile for all ignore file
handling. FileAccess alows us to get the name of the local tempory it
uses for network files. Do this instead of reinventing the wheel.

All ignore files are now read in exactly the same way.
parent 380bc3ce
......@@ -34,30 +34,14 @@ void CvsIgnoreList::init(FileAccess& dir, const t_DirectoryList* pDirList)
const bool bUseLocalCvsIgnore = cvsIgnoreExists(pDirList);
if(bUseLocalCvsIgnore)
{
//TODO: Use QTextStream here.
FileAccess file(dir);
file.addPath(".cvsignore");
qint64 size = file.sizeForReading();
if(size > 0)
if(file.exists() && file.isLocal())
addEntriesFromFile(file.absoluteFilePath());
else
{
char* buf = new char[size];
if(buf != nullptr)
{
file.readFile(buf, size);
qint64 pos1 = 0;
for(qint64 pos = 0; pos <= size; ++pos)
{
if(pos == size || buf[pos] == ' ' || buf[pos] == '\t' || buf[pos] == '\n' || buf[pos] == '\r')
{
if(pos > pos1 && pos - pos1 <= TYPE_MAX(QtNumberType))
{
addEntry(QString::fromLatin1(&buf[pos1], (QtNumberType)(pos - pos1)));
}
++pos1;
}
}
delete[] buf;
}
file.createLocalCopy();
addEntriesFromFile(file.getTempName());
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment