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_r342642094
 
 

 ##########
 File path: be/src/util/file_utils.cpp
 ##########
 @@ -93,6 +150,34 @@ Status FileUtils::list_files(Env* env, const std::string& 
dir,
     return env->iterate_dir(dir, cb);
 }
 
+Status FileUtils::list_dirs_files(const std::string& path, 
std::set<std::string> *dirs,
+                             std::set<std::string> *files, Env *env) {
+    auto cb = [path, dirs, files, env](const char* name) -> bool {
+        if ('.' == name[0]) {
+            return true;
+        }
+        
+        string temp_path =  path + "/" + name;
+        bool is_dir;
+        
+        if (env->is_directory(temp_path, &is_dir).ok()) {
+            if (is_dir) {
+                if (nullptr != dirs) {
+                    dirs->insert(name);
+                }
+            } else if(nullptr != files) {
+                files->insert(name);
+            }
+        } else {
+            LOG(WARNING) << "check path " << path << "is directory error";
 
 Review comment:
   better to print st's error message

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