mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 08:16:16 -07:00
Code clean up
This commit is contained in:
parent
5696944c6f
commit
64f4775a81
10 changed files with 19 additions and 26 deletions
11
src/misc.cpp
11
src/misc.cpp
|
@ -281,8 +281,7 @@ QString misc::truncateRootFolder(boost::intrusive_ptr<torrent_info> t) {
|
|||
#else
|
||||
QString path = QString::fromUtf8(t->file_at(0).path.string().c_str());
|
||||
#endif
|
||||
QStringList path_parts = path.split("/", QString::SkipEmptyParts);
|
||||
t->rename_file(0, path_parts.last().toUtf8().data());
|
||||
t->rename_file(0, fileName(path).toUtf8().data());
|
||||
return QString::null;
|
||||
}
|
||||
QString root_folder;
|
||||
|
@ -316,8 +315,7 @@ QString misc::truncateRootFolder(libtorrent::torrent_handle h) {
|
|||
#else
|
||||
QString path = QString::fromUtf8(t.file_at(0).path.string().c_str());
|
||||
#endif
|
||||
QStringList path_parts = path.split("/", QString::SkipEmptyParts);
|
||||
t.rename_file(0, path_parts.last().toUtf8().data());
|
||||
t.rename_file(0, fileName(path).toUtf8().data());
|
||||
return QString::null;
|
||||
}
|
||||
QString root_folder;
|
||||
|
@ -747,9 +745,10 @@ bool misc::isValidTorrentFile(const QString &torrent_path) {
|
|||
return true;
|
||||
}
|
||||
|
||||
QString misc::branchPath(QString file_path)
|
||||
QString misc::branchPath(QString file_path, bool uses_slashes)
|
||||
{
|
||||
file_path.replace("\\", "/");
|
||||
if(!uses_slashes)
|
||||
file_path.replace("\\", "/");
|
||||
return file_path.left(file_path.lastIndexOf('/'));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue