-
Notifications
You must be signed in to change notification settings - Fork 103
Fix util clear directory #1121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix util clear directory #1121
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,12 +7,12 @@ | |
| #include <paths.h> | ||
| #endif | ||
|
|
||
| #include <ert/util/ert_api_config.hpp> | ||
|
|
||
| #include <cstdlib> | ||
| #include <cstdio> | ||
| #include <cstring> | ||
|
|
||
| #include <filesystem> | ||
|
|
||
| #include <ert/util/util.hpp> | ||
| #include <ert/util/test_work_area.hpp> | ||
|
|
||
|
|
@@ -187,8 +187,11 @@ TestArea::TestArea(const std::string &test_name, bool store_area) | |
| } | ||
|
|
||
| TestArea::~TestArea() { | ||
| if (!this->store) | ||
| util_clear_directory(this->cwd.c_str(), true, true); | ||
| if (!this->store) { | ||
| std::error_code ec; | ||
| std::filesystem::remove_all(this->cwd, ec); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I missed that. That complicates this quite a bit so I think we will have to reconsider.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really know in which context the deletion is triggered. If this is only used in some kind of test cleanup it might be fine using the
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its probably fine since it is indeed test clean up. It is a really minor change in behavior and we could claim that changing the ownership inside the directory was never defined before or even that the test interface was never part of the public interface. I am leaning towards that we should also remove anything test related in the interface.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good to me. |
||
| // silently fail for backwards compatibility | ||
| } | ||
|
|
||
| util_chdir(this->org_cwd.c_str()); | ||
| } | ||
|
|
||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.