c# - How to get notified about the deletion of a directory watched by FileSystemWatcher? -


i informed if monitored directory gets deleted (/renamed/moved).

perhaps following pseudo c# code helps understand problem:

bool called = false; var fsw = new filesystemwatcher(path); fsw.error += delegate(object s, erroreventargs args) {     assert.that(args.getexception() ioexception);     called = true; }; fsw.deleted += delegate(object source, filesystemeventargs e) {     assert.that(e.changetype, is.equalto(watcherchangetypes.deleted));     called = true; }; directory.delete(path); thread.sleep(1000); assert.that(called, is.true); 

if call waitforchanged method ioexception returned there way notified problem?

the mono implementation on linux works fine , returns deleted event. .net implementation on windows seems differ in behaviour.

you create second filesystemwatcher, 1 level up, , set filter , notifyfilter monitor directory , events interested in.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -