Ignore already existing file when download is requested, fixes #67
This commit is contained in:
parent
dba973b522
commit
a95dcc4efc
1 changed files with 6 additions and 2 deletions
|
@ -536,11 +536,15 @@ void TDLibWrapper::copyFileToDownloads(const QString &filePath)
|
|||
QFileInfo fileInfo(filePath);
|
||||
if (fileInfo.exists()) {
|
||||
QString downloadFilePath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + "/" + fileInfo.fileName();
|
||||
if (QFile::exists(downloadFilePath)) {
|
||||
emit copyToDownloadsSuccessful(fileInfo.fileName(), downloadFilePath);
|
||||
} else {
|
||||
if (QFile::copy(filePath, downloadFilePath)) {
|
||||
emit copyToDownloadsSuccessful(fileInfo.fileName(), downloadFilePath);
|
||||
} else {
|
||||
emit copyToDownloadsError(fileInfo.fileName(), downloadFilePath);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
emit copyToDownloadsError(fileInfo.fileName(), filePath);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue