fix: only append '.added' suffix to watchdir files (#5705)

This commit is contained in:
Charles Kerr
2023-11-04 13:14:08 -05:00
committed by GitHub
parent 089c438512
commit 2c9768bc12
8 changed files with 83 additions and 41 deletions

View File

@@ -14,6 +14,14 @@
class AddData
{
public:
// what to do with the source file after adding the torrent
enum class FilenameDisposal
{
NoAction,
Delete,
Rename
};
enum
{
NONE,
@@ -36,6 +44,18 @@ public:
QString readableName() const;
QString readableShortName() const;
void disposeSourceFile() const;
constexpr void setFileDisposal(FilenameDisposal disposal)
{
disposal_ = disposal;
}
constexpr auto& fileDisposal() const noexcept
{
return disposal_;
}
static std::optional<AddData> create(QString const& str)
{
if (auto ret = AddData{ str }; ret.type != NONE)
@@ -51,4 +71,7 @@ public:
QString filename;
QString magnet;
QUrl url;
private:
std::optional<FilenameDisposal> disposal_;
};