ThomasMonkman / filewatch

File watcher in c++
MIT License
426 stars 70 forks source link

The removed even is not triggered when a folder is deleted. #40

Closed SC5Shout closed 1 year ago

SC5Shout commented 1 year ago

Having this hierarchy

when Inner Folder is deleted, the modified event on New Folder is triggered. I believe the "removed" event also should be activated.

filewatch::FileWatch<std::string> watch{"./project",
    [this](const std::filesystem::path& path, const filewatch::Event event) {
        const auto workingPath = AssetManager::ASSET_PATH / path;
        if(std::filesystem::is_directory(workingPath)) {
            std::cout << filewatch::event_to_string(event) << "\n";
        }
    } 
};

It may be because of the folder is already removed: if(std::filesystem::is_directory(workingPath)) at this point. I'm not sure, though.

SC5Shout commented 1 year ago

Yup, it's because the folder is already deleted when if is called.

ThomasMonkman commented 1 year ago

Ahh thank you for the follow up check :)