nickva commented on code in PR #5114:
URL: https://github.com/apache/couchdb/pull/5114#discussion_r1665950286
##########
src/config/src/config.erl:
##########
@@ -455,6 +466,24 @@ read_ini_file(IniFile) ->
throw({startup_error, Msg})
end.
+get_write_file([_ | _] = IniFiles) ->
+ lists:last(IniFiles);
+get_write_file(_) ->
+ undefined.
+
+% Takes a list of files and directories with *.ini files, and expands
+% the directories inline with individual *.ini files
+expand_dirs(IniFilesDirs) ->
+ lists:flatmap(fun expand_dirs_fmap/1, IniFilesDirs).
+
+expand_dirs_fmap(File) ->
+ case filelib:is_dir(File) of
+ true ->
+ lists:sort(filelib:wildcard(File ++ "/*.ini"));
Review Comment:
Updated. One difference was also that wildcard/2 doesn't produce full paths
just plain filenames, so to return the previous results we have to prepend the
directory to the result:
```erlang
Fun = fun(IniFile) -> filename:join(File, IniFile) end,
lists:map(Fun, lists:sort(filelib:wildcard("*.ini", File)));
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]