[rfile] ListKeys: don't include the root directory itself in the listing#22542
Conversation
Test Results 21 files 21 suites 3d 10h 18m 53s ⏱️ For more details on these failures, see this check. Results for commit ef1c2d7. |
jblomer
left a comment
There was a problem hiding this comment.
I'm not sure if it is true that we generally know that the directory to be listed is present. Can we distinguish between an empty directory and a non-existing directory?
That is a good point. You can get that information by calling My impression is that the first choice is superior because when you call In fact, the whole concept of "empty directory" is pretty second class in RFile: you cannot create an empty directory through RFile and you are not really supposed to distinguish the case of empty vs non-existing dir semantically. |
vepadulano
left a comment
There was a problem hiding this comment.
I think it's fine as long as it is documented, thanks!
This Pull request:
changes the behavior of
RFile::ListKeysto exclude the root directory itself from the list of returned keyInfos.Previously
ListKeys("a", kListDirs)would return (e.g.){ "a", "a/b", "a/c", "a/d" }; now it only returns{ "a/b", "a/c", "a/d" }.Rationale: you generally don't care about the root dir in the listing, since you already know it's there.