mirror of
https://github.com/rwengine/openrw.git
synced 2024-09-18 16:32:32 +02:00
tests/test_config: ignore errors when removing temporary files/directories
This commit is contained in:
parent
58f219c04d
commit
e190fc54fb
@ -77,6 +77,7 @@ public:
|
|||||||
std::string dirname() const {
|
std::string dirname() const {
|
||||||
return this->m_path.parent_path().string();
|
return this->m_path.parent_path().string();
|
||||||
}
|
}
|
||||||
|
virtual void change_perms_normal() const = 0;
|
||||||
virtual void change_perms_readonly() const = 0;
|
virtual void change_perms_readonly() const = 0;
|
||||||
virtual void remove() const = 0;
|
virtual void remove() const = 0;
|
||||||
virtual void touch() const = 0;
|
virtual void touch() const = 0;
|
||||||
@ -109,6 +110,12 @@ public:
|
|||||||
virtual ~TempDir() {
|
virtual ~TempDir() {
|
||||||
this->remove();
|
this->remove();
|
||||||
}
|
}
|
||||||
|
virtual void change_perms_normal() const override {
|
||||||
|
rwfs::permissions(this->path(),
|
||||||
|
rwfs::perms::owner_read | rwfs::perms::owner_write | rwfs::perms::owner_exe |
|
||||||
|
rwfs::perms::group_read | rwfs::perms::group_exe |
|
||||||
|
rwfs::perms::others_read | rwfs::perms::others_exe);
|
||||||
|
}
|
||||||
virtual void change_perms_readonly() const override {
|
virtual void change_perms_readonly() const override {
|
||||||
rwfs::permissions(this->path(),
|
rwfs::permissions(this->path(),
|
||||||
rwfs::perms::owner_read | rwfs::perms::owner_exe |
|
rwfs::perms::owner_read | rwfs::perms::owner_exe |
|
||||||
@ -116,7 +123,9 @@ public:
|
|||||||
rwfs::perms::others_read | rwfs::perms::others_exe);
|
rwfs::perms::others_read | rwfs::perms::others_exe);
|
||||||
}
|
}
|
||||||
virtual void remove() const override {
|
virtual void remove() const override {
|
||||||
rwfs::remove_all(this->path());
|
// Remove may fail if this directory contains a read-only entry. Ignore.
|
||||||
|
rwfs::error_code ec;
|
||||||
|
rwfs::remove_all(this->path(), ec);
|
||||||
}
|
}
|
||||||
void touch() const override {
|
void touch() const override {
|
||||||
rwfs::create_directories(this->path());
|
rwfs::create_directories(this->path());
|
||||||
@ -133,13 +142,20 @@ public:
|
|||||||
virtual ~TempFile() {
|
virtual ~TempFile() {
|
||||||
this->remove();
|
this->remove();
|
||||||
}
|
}
|
||||||
|
virtual void change_perms_normal() const override {
|
||||||
|
rwfs::permissions(this->path(),
|
||||||
|
rwfs::perms::owner_read | rwfs::perms::owner_write |
|
||||||
|
rwfs::perms::group_read |
|
||||||
|
rwfs::perms::others_read);
|
||||||
|
}
|
||||||
virtual void change_perms_readonly() const override {
|
virtual void change_perms_readonly() const override {
|
||||||
rwfs::permissions(this->path(), rwfs::perms::owner_read |
|
rwfs::permissions(this->path(), rwfs::perms::owner_read |
|
||||||
rwfs::perms::group_read |
|
rwfs::perms::group_read |
|
||||||
rwfs::perms::others_read);
|
rwfs::perms::others_read);
|
||||||
}
|
}
|
||||||
virtual void remove() const override {
|
virtual void remove() const override {
|
||||||
rwfs::remove_all(this->path());
|
rwfs::error_code ec;
|
||||||
|
rwfs::remove_all(this->path(), ec);
|
||||||
}
|
}
|
||||||
virtual void touch() const override {
|
virtual void touch() const override {
|
||||||
std::ofstream ofs(this->path().string(), std::ios::out | std::ios::app);
|
std::ofstream ofs(this->path().string(), std::ios::out | std::ios::app);
|
||||||
|
Loading…
Reference in New Issue
Block a user