Skip to main content



friendica (DFRN) - Link to source

A.I. VS 10 year old kid..


in reply to plan-A

mozzerfokkeur tempting me??

#include <iostream>
#include <filesystem>
#include <chrono>
#include <thread>

namespace fs = std::filesystem;

int main() {
    std::string path = ".";
    std::cout << "Watcher activated. Monitoring for .py and .cpp changes...\n";

    auto last_write = fs::last_write_time(path);

    while (true) {
        std::this_thread::sleep_for(std::chrono::seconds(2));

        for (const auto &entry : fs::directory_iterator(path)) {
            auto ext = entry.path().extension();
            if (ext == ".py" || ext == ".cpp") {
                auto current_write = fs::last_write_time(entry);
                if (current_write != last_write) {
                    std::cout << "Changed: " << entry.path().filename() << "\n";
                    last_write = current_write;
                }
            }
        }
    }

    return 0;
}     
in reply to plan-A

friendica (DFRN) - Link to source
plan-A
 — (Proud Eskimo!)