fix, do not remove non-empty directory
This commit is contained in:
parent
a8c2902fca
commit
9cd94670d1
|
@ -310,6 +310,8 @@ int MTPDevice::dirRemove(const std::string &path)
|
|||
logerr("No such directory '", path, "' to remove.\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
if (!dir_to_remove->isEmpty())
|
||||
return -ENOTEMPTY;
|
||||
criticalEnter();
|
||||
int rval = LIBMTP_Delete_Object(m_device, dir_to_remove->id());
|
||||
criticalLeave();
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
const TypeFile *file(const std::string &name) const;
|
||||
std::set<TypeDir> dirs() const { return m_dirs; }
|
||||
std::set<TypeFile> files() const { return m_files; }
|
||||
bool isEmpty() const { return m_dirs.empty() && m_files.empty(); }
|
||||
|
||||
LIBMTP_folder_t *toLIBMTPFolder() const;
|
||||
TypeDir &operator =(const TypeDir &rhs);
|
||||
|
|
Loading…
Reference in New Issue