我遇到问题。我用FileSystemWatcher
写了一个包装,它检测根文件夹及其所有子文件夹中的更改。没有什么奇特的:FileSystemWatcher在单播观看子目录下
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Path = this.Root;
watcher.IncludeSubdirectories = true;
watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.LastAccess | NotifyFilters.DirectoryName | NotifyFilters.FileName;
watcher.Changed += new FileSystemEventHandler (watcher_Changed);
watcher.Deleted += new FileSystemEventHandler (watcher_Deleted);
watcher.Created += new FileSystemEventHandler (watcher_Created);
watcher.Renamed += new RenamedEventHandler (watcher_Renamed);
watcher.EnableRaisingEvents = true;
在.NET中,在Windows下,它就像一个魅力。但是,当我将代码移植到mono并在OSX下运行代码时,它只能在根文件夹中正常工作。
问题我已经通过,现在发现:
事件不会在观察者开始
路径我通过
EventArgs.FullPath
属性获取时间下根已经存在的文件夹内,提高了操作不正确(当我将一个文件复制到path_to_root/some/more/subdirs/some.file时,我得到的路径就是path_to_root/some.file)。
与unproper路径问题已经被报道一年前(和看起来好像是解决了),但我的单来自于去年十二月(MonoDevelop的说,在参考部分是4.0.0.0版本,它是所有我可以说的分布)和错误仍然存在... 请参阅: https://bugzilla.xamarin.com/show_bug.cgi?id=5747
任何想法?我真的很好奇,如果有一个解决方法不需要写自己的观察者轮询文件系统重复或启动每个文件夹下的每个文件夹根 ...
在此先感谢!
可能,这可以帮助:不净FileSystemWatcher的工作与 - 单上-MAC-OS] [1] [1]:http://stackoverflow.com/问题/ 5727652/do-net-filesystemwatcher-work-with-mono-on-mac-os – 2013-05-13 10:55:08
看到这个话题,不幸的是我找不到任何帮助...但谢谢! – wojtuch 2013-05-13 10:58:28
如果5747修正错误的未解决您的情况,您应该简单地建立在http://bugzilla.xamarin.com – knocte 2013-08-09 12:22:21