imay commented on a change in pull request #2089: Change refactor and
reorganize the file utils
URL: https://github.com/apache/incubator-doris/pull/2089#discussion_r342642697
##########
File path: be/src/util/file_utils.cpp
##########
@@ -82,6 +110,35 @@ Status FileUtils::remove_all(const std::string& file_path)
{
return Status::OK();
}
+Status FileUtils::remove(const std::string& path, doris::Env *env) {
+ bool is_dir;
+ Status ret = env->is_directory(path, &is_dir);
+ if (ret.ok()) {
+ if (is_dir) {
+ return env->delete_dir(path);
+ } else {
+ return env->delete_file(path);
+ }
+ } else {
+ return ret;
+ }
+}
+
+Status FileUtils::remove(const std::string& path) {
+ return remove(path, Env::Default());
+}
+
+Status FileUtils::remove_paths(const std::vector<string>& paths) {
+ for (string p : paths) {
+ Status ret = remove(p);
Review comment:
```suggestion
RETURN_IF_ERROR(remove(p));
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]