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,10 +536,14 @@ void TDLibWrapper::copyFileToDownloads(const QString &filePath)
|
|||
QFileInfo fileInfo(filePath);
|
||||
if (fileInfo.exists()) {
|
||||
QString downloadFilePath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + "/" + fileInfo.fileName();
|
||||
if (QFile::copy(filePath, downloadFilePath)) {
|
||||
if (QFile::exists(downloadFilePath)) {
|
||||
emit copyToDownloadsSuccessful(fileInfo.fileName(), downloadFilePath);
|
||||
} else {
|
||||
emit copyToDownloadsError(fileInfo.fileName(), downloadFilePath);
|
||||
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