Git Product home page Git Product logo

Comments (18)

sbusch42 avatar sbusch42 commented on August 23, 2024 1

Let's do it then :)

I've created a branch and starting implementing the linux backend:
https://github.com/cginternals/cppfs/tree/watcher

You could start implementing the Windows backend, if you like.
Please comment on the architecture and design.

from cppfs.

robiwano avatar robiwano commented on August 23, 2024 1

from cppfs.

sbusch42 avatar sbusch42 commented on August 23, 2024 1

This has finally been merged. Thank you very much for your contribution!
Please let me know if there are any more issues with this, or if I accidentally broke something with my latest changes :)

from cppfs.

robiwano avatar robiwano commented on August 23, 2024

Is there any work being done on this ? I'm in need of a simple filesystem watcher and could maybe contribute with at least linux + windows watchers.

from cppfs.

robiwano avatar robiwano commented on August 23, 2024

Actually, I've already implemented the Windows parts, and have started on linux backend, I'll push to my own fork it you want to check it out.

from cppfs.

robiwano avatar robiwano commented on August 23, 2024

Since inotify isn't recursive, I need to add watches on subfolders, and handle creation of subfolders aswell. Please do have a view at https://github.com/robiwano/cppfs for the general design pattern for file watchers.

from cppfs.

robiwano avatar robiwano commented on August 23, 2024

branch is feature/filewatch

from cppfs.

sbusch42 avatar sbusch42 commented on August 23, 2024

ok, I'll look into it and copy the recursive stuff for the linux backend. We should decide whether we want to have recursive as a flag or not. If you could prepare a pull request for the Windows backend following the interface in the watcher branch, that would be great. Let me know if you want changes to the structure/interfaces etc.

from cppfs.

robiwano avatar robiwano commented on August 23, 2024

I'll check the API in the watcher branch :)

from cppfs.

robiwano avatar robiwano commented on August 23, 2024

I like that the watcher stuff is separate from FileHandle. I'll modify my code accordingly.

from cppfs.

sbusch42 avatar sbusch42 commented on August 23, 2024

Please let me know if you are preparing a pull request for this branch to implement the Windows backend.

from cppfs.

robiwano avatar robiwano commented on August 23, 2024

I have a question regarding blocking watch(): My usecase will be a plugin whos lifetime is totally controlled from the outside. The watch() method will be called within a separate thread, thus, when the plugin is destroyed, the watch() method must unblock in order to terminate the thread in an orderly fashion. Thoughts ?

from cppfs.

robiwano avatar robiwano commented on August 23, 2024

Maybe add a timeout option to watch ? So it can return after X milliseconds ?

from cppfs.

robiwano avatar robiwano commented on August 23, 2024

Ok, I'm going with the timeout parameter to watch, turns out to be to cleanest approach. Will also update the cppfs-watch example to take a time parameter so it exits the application after the given time.

from cppfs.

sbusch42 avatar sbusch42 commented on August 23, 2024

I think having a timeout parameter would be a good solution. Please make it optional, so by default it should block without timeout. Maybe this helps for the posix implementation:
https://stackoverflow.com/questions/2917881/how-to-implement-a-timeout-in-read-function-call

from cppfs.

robiwano avatar robiwano commented on August 23, 2024

Yes, I found that same exact post :), seems to work fine for posix implementation, now I just need to get my VS IDE up and running (license expired 😏 )...

from cppfs.

robiwano avatar robiwano commented on August 23, 2024

Btw, is it possible via cppassist cmd line tools to get multiple unnamed parameters into a vector of strings ? I'd like to be able to set multiple paths to monitor in cppfs-watch.

from cppfs.

robiwano avatar robiwano commented on August 23, 2024

Pull request issued.

from cppfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.