Add file watcher API and Linux implementation#15342
Open
meyraud705 wants to merge 1 commit intolibsdl-org:mainfrom
Open
Add file watcher API and Linux implementation#15342meyraud705 wants to merge 1 commit intolibsdl-org:mainfrom
meyraud705 wants to merge 1 commit intolibsdl-org:mainfrom
Conversation
sezero
reviewed
Apr 8, 2026
Contributor
|
A design consideration: would it be possible to use a callback instead of an event? If a given program listens to different paths at different places in the code, events can make it difficult to transfer the signal from the event loop down to the specific part of the code that needs that event. That was my reasoning when developing the file dialog subsystem; using events would've split the part of the code that invokes the dialog from the part that handles the subsequent file operations, which can make a repo quite messy if not carefully managed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add 1 public function:
bool SDL_WatchFileForChanges(const char *path)and 2 event types:SDL_EVENT_FILE_WATCH_ERRORandSDL_EVENT_FILE_CHANGED.SDL_UpdateFileWatch()is called when pumping event to update file watch. Resources are cleared inSDL_QuitFilesystem(void).Implement this API for Linux using inotify. I put it in
SDL_sysfsops.c, I don't know how other platforms work so that may not be the correct place.Existing Issue(s)
Implement #15070 for Linux.