#include #include #include #include namespace fs = std::filesystem; const std::string dir = "/usr/share/applications"; int main(int argc, char const *argv[]) { for (const auto& entry : fs::directory_iterator(dir)) { if (entry.path().extension() == ".desktop") { std::ifstream file(entry.path()); if (!file.is_open()) { std::cerr << "file not opened" << std::endl; return 1; } std::string output; std::string line; while (std::getline(file, line)) { output += line + "\n"; } std::cout << output << std::endl; file.close(); } } return 0; }