【发布时间】:2018-07-04 15:46:17
【问题描述】:
我正在尝试根据Vala documentation监控~/.local目录我可以正确监控home。但我无法监控 ~/.local。
initFileMonitor V1:
public void initFileMonitor(){
try {
string homePath = Environment.get_home_dir();
string filePath = homePath + "/.local";
File file = File.new_for_path(filePath);
FileMonitor monitor = file.monitor_directory(FileMonitorFlags.NONE, null);
print ("\nMonitoring: %s\n", file.get_path ());
monitor.changed.connect ((src, dest, event) => {
if (dest != null) {
print ("%s: %s, %s\n", event.to_string (), src.get_path (), dest.get_path ());
} else {
print ("%s: %s\n", event.to_string (), src.get_path ());
}
});
} catch (Error err) {
print ("Error: %s\n", err.message);
}
}
终端输出(无错误,无监控):
Monitoring: /home/srdr/.local
【问题讨论】:
标签: directory local monitor glib vala