Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watching files doesn't work on windows? #33

Closed
xahon opened this issue Apr 25, 2020 · 2 comments
Closed

Watching files doesn't work on windows? #33

xahon opened this issue Apr 25, 2020 · 2 comments

Comments

@xahon
Copy link

xahon commented Apr 25, 2020

class TestFileEventHandler : public FileEventHandler {
   public:
    virtual void onFileEvent(FileHandle& fh, FileEvent event) override { //
        LOG_DEBUG("File Event"); // Not getting called
    }
};

int main() {
    TestFileEventHandler eventHandler;
    FileWatcher watcher;
    FileHandle dir = Fs::OpenFileHandle(std::move(std::string("assets://shaders")));
    // Valid path. Expands to "C:/dev/opengl_game/out/build/x64-Debug/bin/assets/shaders"
    watcher.add(dir);
    watcher.addHandler(&eventHandler);

    while (true) {
        watcher.watch(-1);
        LOG_DEBUG("Loop");
    }

    return 0;
}
@sbusch42
Copy link
Member

Unfortunately, I don't have a Windows system to test this at the moment.

  • Have you tested this on a different path ("C:..."), does it work there? (so it has something to do with the "assets://" path?)
  • Can you confirm that a valid instance of LocalFileWatcher backend is created?

I'm not aware of this "assets://" path and I don't find anything about it. I doubt this is a valid Windows path. How does this work and what system is responsible for expanding it? How is it expanded to "C:/dev/opengl_game"?

@xahon
Copy link
Author

xahon commented Apr 27, 2020

@sbusch42 Sorry, my bad. I opened file watcher in binary path and tried to change sources in source directory

P.S. Fs::OpenFileHandle does this path convertion under the hood - it is my custom command that points to the binary_dir/assets/shaders

@xahon xahon closed this as completed Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants