From 9394984137db32cc15c1fd9b8a2c3241ec705cb0 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sun, 15 Feb 2015 00:23:19 -0600 Subject: [PATCH] watchlist,watchedpath: Query file type directly I'm not entirely sure why, possibly a bug in some version(s) of GLib, the file type returned by the `get_file_type` method of a `FileInfo` object yielded by a `FileEnumerator` is always `UNKNOWN`. Querying the file type directly using `File.query_file_type` works much more reliably. --- src/watchedpath.vala | 3 ++- src/watchlist.vala | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/watchedpath.vala b/src/watchedpath.vala index 4f1ab11..cdff5c7 100644 --- a/src/watchedpath.vala +++ b/src/watchedpath.vala @@ -70,7 +70,8 @@ namespace onchanged { FileInfo info; while ((info = enumerator.next_file()) != null) { var f = dir.resolve_relative_path(info.get_name()); - if (info.get_file_type() == FileType.DIRECTORY) { + var ftype = f.query_file_type(FileQueryInfoFlags.NONE); + if (ftype == FileType.DIRECTORY) { watch(f); watch_children(f); } diff --git a/src/watchlist.vala b/src/watchlist.vala index c562b90..06e0b05 100644 --- a/src/watchlist.vala +++ b/src/watchlist.vala @@ -82,7 +82,8 @@ namespace onchanged { FileInfo info; while ((info = enumerator.next_file()) != null) { var f = dir.resolve_relative_path(info.get_name()); - if (info.get_file_type() == FileType.DIRECTORY) { + var ftype = f.query_file_type(FileQueryInfoFlags.NONE); + if (ftype == FileType.DIRECTORY) { read_config_dir(f); } else { read_config(f.get_path());