mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-03-10 20:31:47 +00:00
Also hide the unwanted files on Windows
This commit is contained in:
parent
818a032aac
commit
f6b96694e0
@ -45,6 +45,10 @@
|
|||||||
#include <libtorrent/entry.hpp>
|
#include <libtorrent/entry.hpp>
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
|
#include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -509,7 +513,14 @@ void QTorrentHandle::prioritize_files(const vector<int> &files) const {
|
|||||||
QString old_name = filename_at(i);
|
QString old_name = filename_at(i);
|
||||||
QDir parent_path(misc::branchPath(old_path));
|
QDir parent_path(misc::branchPath(old_path));
|
||||||
if(parent_path.dirName() != ".unwanted") {
|
if(parent_path.dirName() != ".unwanted") {
|
||||||
parent_path.mkdir(".unwanted");
|
bool created = parent_path.mkdir(".unwanted");
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
|
// Hide the folder on Windows
|
||||||
|
DWORD dwAttrs = GetFileAttributes(parent_path.absolutePath().toLocal8Bit().data());
|
||||||
|
SetFileAttributes(parent_path.absolutePath().toLocal8Bit().data(), dwAttrs|FILE_ATTRIBUTE_HIDDEN);
|
||||||
|
#else
|
||||||
|
Q_UNUSED(created);
|
||||||
|
#endif
|
||||||
rename_file(i, parent_path.filePath(".unwanted/"+old_name));
|
rename_file(i, parent_path.filePath(".unwanted/"+old_name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user