Page 1 of 1
MonitorDirectory
Posted: Wed Apr 08, 2020 12:07 am
by plouf
Hi
playing with MonitorDirectory, i notice that it will report changes in a directory AND its subdirectories, however table.directory name is always the initian one
if for example i monitor C:\test will report changes in C:test\subtest changes too
but table.directory will only tell "C:\test" in both cases
Is there a way to determine what has changed ?
also it does not allow for slah but backslash !
MonitorDirectory(1, "E:/Alarm/1")<- accept
MonitorDirectory(1, "E:\Alarm\1")<- Unknown sequence character after backslash!
do i miss something ?
test under Windwos7
Re: MonitorDirectory
Posted: Wed Apr 08, 2020 7:10 am
by jPV
I don't know if OS itself reports either what's changed in the directory you monitor, so it might not be possible to get more detailed information. In these cases you should monitor each subdir themselves...
Of course it would be nice if it'd be possible to let us know what's changed, but if not, I would like to see a MonitorFile function too. I had to monitor datafile changes in RNOXfer's temp dir, and I ended up placing each data file in their own directory and monitor them that way. So, it would make things clearer if you could monitor individual files too. For example, the WaitForNotification shell command in MorphOS handles both directories and files.
Re: MonitorDirectory
Posted: Wed Apr 08, 2020 10:47 pm
by airsoftsoftwair
I can confirm that it indeed triggers for subdirectories on Windows... this shouldn't be the case. I'll have to examine.
plouf wrote: ↑Wed Apr 08, 2020 12:07 am
MonitorDirectory(1, "E:\Alarm\1")<- Unknown sequence character after backslash!
do i miss something ?
Yes, backslashes must be escaped, i.e.
Code: Select all
MonitorDirectory(1, "E:\\Alarm\\1")
Then it should work.
Re: MonitorDirectory
Posted: Thu Apr 09, 2020 1:03 pm
by airsoftsoftwair
Ok, so this isn't a bug. If you monitor the directory "test" and you change something in the directory "test/subdir", obviously the timestamp of the directory "subdir" changes which then triggers a change notification on "test". So this is perfectly right behaviour. You won't get a notification if you change anything two levels down the tree, i.e. monitor "test" and change something in "test/subdir/subdir". So all behaviour is completely correct here.
Re: MonitorDirectory
Posted: Thu Apr 09, 2020 1:24 pm
by plouf
ok so, original question apply (it was orignilay a question

)
"is there a way to determine what has changed ?"
i understand that you could get a list of files and dates, when first start program, and then compare it every time.
But this may be extremely time/cpu consuming if drawers get bigger and bigger
Re: MonitorDirectory
Posted: Mon Apr 13, 2020 10:33 am
by airsoftsoftwair
plouf wrote: ↑Thu Apr 09, 2020 1:24 pm
ok so, original question apply (it was orignilay a question

)
"is there a way to determine what has changed ?"
Currently not, but I agree that this would be a nice addition. I'll see what I can do.
Re: MonitorDirectory
Posted: Sat Sep 26, 2020 9:19 pm
by airsoftsoftwair
Code: Select all
- New [OS4/Windows]: MonitorDirectory() accepts a new "ReportChanges" tag now; if this is set to TRUE, your
event callback will also be notified about what exactly has changed; there will be two new parameters:
"Type" informing you about the type of change (add, remove, change) and "Name" will contain the name of
the file or directory that has been changed; note that the "All" argument has no effect when setting
"ReportChanges" to TRUE