mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-05 03:14:44 +00:00
Drop extension from generated content folder name
Try to detect whether generated content folder name contains extension and drop it to avoid possible conflicts between file/folder names.
This commit is contained in:
parent
2b9c7e04a4
commit
ae29e8bbab
@ -481,9 +481,17 @@ void TorrentInfo::stripRootFolder()
|
|||||||
|
|
||||||
void TorrentInfo::addRootFolder()
|
void TorrentInfo::addRootFolder()
|
||||||
{
|
{
|
||||||
const QString rootFolder = name();
|
const QString originalName = name();
|
||||||
Q_ASSERT(!rootFolder.isEmpty());
|
Q_ASSERT(!originalName.isEmpty());
|
||||||
|
|
||||||
|
const QString extension = Utils::Fs::fileExtension(originalName);
|
||||||
|
const QString rootFolder = extension.isEmpty()
|
||||||
|
? originalName
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||||
|
: originalName.chopped(extension.size() + 1);
|
||||||
|
#else
|
||||||
|
: originalName.left(originalName.size() - (extension.size() + 1));
|
||||||
|
#endif
|
||||||
const std::string rootPrefix = Utils::Fs::toNativePath(rootFolder + QLatin1Char {'/'}).toStdString();
|
const std::string rootPrefix = Utils::Fs::toNativePath(rootFolder + QLatin1Char {'/'}).toStdString();
|
||||||
lt::file_storage files = m_nativeInfo->files();
|
lt::file_storage files = m_nativeInfo->files();
|
||||||
files.set_name(rootFolder.toStdString());
|
files.set_name(rootFolder.toStdString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user