meta4d-me / CatDogEngine

A cross-platform game engine/editor written in modern C++ (WIP)
GNU General Public License v2.0
161 stars 17 forks source link

FileWatcher #372

Closed roeas closed 1 year ago

roeas commented 1 year ago

Usage:

void CreateCB(std::string path)
{
    CD_FATAL("Create : {0}.", cd::MoveTemp(path));
}

void ModifyCB(std::string path)
{
    CD_FATAL("Modify : {0}.", cd::MoveTemp(path));
}

void RenameOldCB(std::string path)
{
    CD_FATAL("RenameOld : {0}.", cd::MoveTemp(path));
}

void RenameNewCB(std::string path)
{
    CD_FATAL("RenameNew : {0}.", cd::MoveTemp(path));
}

void DeleteCB(std::string path)
{
    CD_FATAL("Delete : {0}.", cd::MoveTemp(path));
}
m_pFileWatcher = std::make_unique<FileWatcher>(CDENGINE_BUILTIN_SHADER_PATH);
m_pFileWatcher->EnableWatchSubTree();
m_pFileWatcher->SetFileAddedCallback(CreateCB);
m_pFileWatcher->SetFileModifiedCallback(ModifyCB);
m_pFileWatcher->SetFileRenamedOldCallback(RenameOldCB);
m_pFileWatcher->SetFileRenamedNewCallback(RenameNewCB);
m_pFileWatcher->SetFileRemovedCallback(DeleteCB);
m_pFileWatcher->Start();

image No Chinese support.