blob: 0bf5615d9ee026ffafb2bf8fb6c6fd8a63361303 [file] [log] [blame]
#include <filesystem>
#include <fstream>
#include <iostream>
int main(int argc, char* argv[]) {
if (argc < 2) {
std::cout << "No Doxyfile provided." << std::endl;
exit(1);
}
std::string doxyfile_path{argv[1]};
std::string out_path{doxyfile_path.substr(0, doxyfile_path.find_last_of("/\\") + 1)};
std::cout << "Doxyfile path: " << doxyfile_path << std::endl;
std::cout << "Output path: " << out_path << std::endl;
// Create an html directory if it doesn't exist
if (!std::filesystem::exists(out_path + "html")) {
std::filesystem::create_directory(out_path + "html");
}
// Generate a simple HTML file as documentation
std::ofstream file(out_path + "html/index.html");
file << "<!DOCTYPE html>\n"
"<html>\n"
"<head>\n"
" <title>Self-Documenting Code</title>\n"
"</head>\n"
"<body>\n"
" <h1>Self-Documenting Code Example</h1>\n"
" <p>This C++ program generates its own documentation.</p>\n"
" <p>Doxyfile used: "
<< doxyfile_path
<< "</p>\n"
" <p>Output directory: "
<< out_path
<< "</p>\n"
" <p>Generated by a custom executable mimicking Doxygen 1.15.0.</p>\n"
"</body>\n"
"</html>\n";
file.close();
std::cout << "Self-documenting code generated: html/index.html" << std::endl;
return 0;
}