From f6b96694e0eef9053be5b63abb59eb06b5cdf1b2 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 6 Jan 2011 12:26:14 +0000 Subject: [PATCH] Also hide the unwanted files on Windows --- src/qtlibtorrent/qtorrenthandle.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/qtlibtorrent/qtorrenthandle.cpp b/src/qtlibtorrent/qtorrenthandle.cpp index ff50f0120..efaa5c059 100644 --- a/src/qtlibtorrent/qtorrenthandle.cpp +++ b/src/qtlibtorrent/qtorrenthandle.cpp @@ -45,6 +45,10 @@ #include #include +#ifdef Q_WS_WIN + #include +#endif + using namespace libtorrent; using namespace std; @@ -509,7 +513,14 @@ void QTorrentHandle::prioritize_files(const vector &files) const { QString old_name = filename_at(i); QDir parent_path(misc::branchPath(old_path)); 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)); } }