shared: FileSaver: addFile(): Consider fillExistingContentless
This commit is contained in:
parent
a869d677a3
commit
32c2653b0f
@ -25,10 +25,22 @@ SaveFileResult FileSaver::addFile(QString path)
|
|||||||
QString absPath = info.absoluteFilePath();
|
QString absPath = info.absoluteFilePath();
|
||||||
|
|
||||||
auto mtime = info.lastModified().toSecsSinceEpoch();
|
auto mtime = info.lastModified().toSecsSinceEpoch();
|
||||||
if(this->dbService->fileExistsInDatabase(absPath, mtime))
|
|
||||||
|
bool exists = false;
|
||||||
|
if(this->fileSaverOptions.fillExistingContentless)
|
||||||
|
{
|
||||||
|
exists = this->dbService->fileExistsInDatabase(absPath, mtime, 'c');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
exists = this->dbService->fileExistsInDatabase(absPath, mtime);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(exists)
|
||||||
{
|
{
|
||||||
return SKIPPED;
|
return SKIPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
return saveFile(info);
|
return saveFile(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,10 +146,7 @@ SaveFileResult FileSaver::saveFile(const QFileInfo &fileInfo)
|
|||||||
if(mustFillContent)
|
if(mustFillContent)
|
||||||
{
|
{
|
||||||
auto filetype = this->dbService->queryFileType(fileInfo.absolutePath());
|
auto filetype = this->dbService->queryFileType(fileInfo.absolutePath());
|
||||||
if(filetype)
|
mustFillContent = !filetype.has_value() || filetype.value() == 'c';
|
||||||
{
|
|
||||||
mustFillContent = filetype.value() == 'c';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user