mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 07:27:22 -06:00
Fix improvement for file permissions on Windows
This commit is contained in:
10
src/misc.h
10
src/misc.h
@@ -38,6 +38,7 @@
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
#include <boost/date_time/posix_time/conversion.hpp>
|
||||
#include <QPoint>
|
||||
#include <QFile>
|
||||
|
||||
#include <libtorrent/torrent_info.hpp>
|
||||
#include <libtorrent/torrent_handle.hpp>
|
||||
@@ -81,6 +82,15 @@ public:
|
||||
return x;
|
||||
}
|
||||
|
||||
static bool safeRemove(QString file_path) {
|
||||
QFile MyFile(file_path);
|
||||
if(!MyFile.exists()) return true;
|
||||
// Make sure the permissions are ok
|
||||
MyFile.setPermissions(MyFile.permissions()|QFile::ReadOwner|QFile::WriteOwner|QFile::ReadUser|QFile::WriteUser);
|
||||
// Actually remove the file
|
||||
return MyFile.remove();
|
||||
}
|
||||
|
||||
static QString truncateRootFolder(boost::intrusive_ptr<torrent_info> t);
|
||||
static QString truncateRootFolder(torrent_handle h);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user