LiamG
January 29, 2022, 3:49pm
1
Is there any way in JUCE of getting a notification or callback when a particular file has changed? In this case, it’s an Xml file that I’m working with.
1 Like
Does it requires to be synchronous?
Otherwise you could just poll and check getLastModificationTime
in a background thread (but i guess you already considered that).
LiamG
January 29, 2022, 4:33pm
3
I hadn’t thought of this. Not a bad idea if, as it seems, Juce doesn’t have this feature built in.
It would be nice if there were a little listener you could attach to the File
class though. Is this a realistic feature request?
@LiamG It seems an old request and a good question (with maybe a solution).
Hey Julian, what about adding a cross platform class that can abstract directory/file change async notification ?
are you willingly to accept patches in this regard ? all the platforms can support this, but they all do this differently, and sometimes this is very handy.
I can start dig some code, have you an idea on how you would like this kind of class ? i think about a manager with registrable listeners, but you may think something different…
/*==============================================================================
Copyright 2018 by Roland Rabien
For more information visit www.rabiensoftware.com
==============================================================================*/
#pragma once
#if defined JUCE_MAC || defined JUCE_WINDOWS || defined JUCE_LINUX
/**
Watches a folder in the file system for changes.
Listener callbcks will be called every time a file is
created, modified, deleted or renamed in the watched
folder.
FileSystemWatcher will also recursively watch all subfolders on
This file has been truncated. show original
1 Like