32 const std::vector<std::string>& recent_paths,
size_t max_entries,
34 std::vector<RecentFileMenuEntry> entries;
35 std::set<std::string> seen_paths;
36 for (
const std::string& path : recent_paths) {
37 if (entries.size() >= max_entries) {
40 if (path.empty() || !seen_paths.insert(path).second) {
45 entry.
label = FileNameOf(path);
46 entry.
exists = exists ? exists(path) : DefaultExists(path);
47 entries.push_back(std::move(entry));
51 std::map<std::string, int> name_counts;
52 for (
const auto& entry : entries) {
53 ++name_counts[entry.label];
55 for (
auto& entry : entries) {
56 if (name_counts[entry.label] > 1) {
57 const std::string parent = ParentNameOf(entry.path);
58 if (!parent.empty()) {
59 entry.label = entry.label +
" (" + parent +
")";
65 std::map<std::string, int> label_counts;
66 for (
const auto& entry : entries) {
67 ++label_counts[entry.label];
69 for (
auto& entry : entries) {
70 if (label_counts[entry.label] > 1) {
71 entry.label = entry.path;