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_r344158972
 
 

 ##########
 File path: be/src/util/file_utils.cpp
 ##########
 @@ -82,6 +105,28 @@ 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;
+    RETURN_IF_ERROR(env->is_directory(path, &is_dir));
+ 
+    if (is_dir) {
+        return env->delete_dir(path);
+    } else {
+        return env->delete_file(path);
+    }
+}
+
+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) {
 
 Review comment:
   ```suggestion
       for (auto& p : paths) {
   ```
   To avoid memory copy

----------------------------------------------------------------
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]

Reply via email to