mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 13:48:05 -06:00
committed by
GitHub
parent
9f6130cbaa
commit
f44341a8e2
@@ -40,7 +40,6 @@
|
||||
#include <QUrl>
|
||||
|
||||
#include "base/bittorrent/categoryoptions.h"
|
||||
#include "base/bittorrent/common.h"
|
||||
#include "base/bittorrent/downloadpriority.h"
|
||||
#include "base/bittorrent/infohash.h"
|
||||
#include "base/bittorrent/peeraddress.h"
|
||||
@@ -565,14 +564,10 @@ void TorrentsController::filesAction()
|
||||
{KEY_FILE_PROGRESS, fp[index]},
|
||||
{KEY_FILE_PRIORITY, static_cast<int>(priorities[index])},
|
||||
{KEY_FILE_SIZE, torrent->fileSize(index)},
|
||||
{KEY_FILE_AVAILABILITY, fileAvailability[index]}
|
||||
{KEY_FILE_AVAILABILITY, fileAvailability[index]},
|
||||
{KEY_FILE_NAME, Utils::Fs::toUniformPath(torrent->filePath(index))}
|
||||
};
|
||||
|
||||
QString fileName = torrent->filePath(index);
|
||||
if (fileName.endsWith(QB_EXT, Qt::CaseInsensitive))
|
||||
fileName.chop(QB_EXT.size());
|
||||
fileDict[KEY_FILE_NAME] = Utils::Fs::toUniformPath(fileName);
|
||||
|
||||
const BitTorrent::TorrentInfo::PieceRange idx = info.filePieces(index);
|
||||
fileDict[KEY_FILE_PIECE_RANGE] = QJsonArray {idx.first(), idx.last()};
|
||||
|
||||
|
||||
@@ -44,20 +44,16 @@ window.qBittorrent.Filesystem = (function() {
|
||||
};
|
||||
};
|
||||
|
||||
const QB_EXT = '.!qB';
|
||||
const PathSeparator = '/';
|
||||
|
||||
/**
|
||||
* Returns the file extension part of a file name.
|
||||
*/
|
||||
const fileExtension = function(filename) {
|
||||
const name = filename.endsWith(QB_EXT)
|
||||
? filename.substring(0, filename.length - QB_EXT.length)
|
||||
: filename;
|
||||
const pointIndex = name.lastIndexOf('.');
|
||||
const pointIndex = filename.lastIndexOf('.');
|
||||
if (pointIndex === -1)
|
||||
return '';
|
||||
return name.substring(pointIndex + 1);
|
||||
return filename.substring(pointIndex + 1);
|
||||
};
|
||||
|
||||
const fileName = function(filepath) {
|
||||
|
||||
Reference in New Issue
Block a user