[retro-gtk] retro-gobject: Check directory exists
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk] retro-gobject: Check directory exists
- Date: Sun, 18 Sep 2016 16:22:09 +0000 (UTC)
commit acfacac90bf6e5c2e548d71266f79e944b04c300
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sun Sep 18 17:46:12 2016 +0200
retro-gobject: Check directory exists
Check whether a directory exists before listing its content.
This avoids a module lookup query to fail when it should continue.
https://bugzilla.gnome.org/show_bug.cgi?id=771624
retro-gobject/retro-module-query.vala | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/retro-gobject/retro-module-query.vala b/retro-gobject/retro-module-query.vala
index 4d1635e..0e14220 100644
--- a/retro-gobject/retro-module-query.vala
+++ b/retro-gobject/retro-module-query.vala
@@ -21,6 +21,12 @@ namespace Retro.ModuleQuery {
public string? lookup_module_for_info (ModuleInfoQueryCallback callback) throws Error {
foreach (var path in get_plugin_lookup_paths ()) {
var directory = File.new_for_path (path);
+ if (!directory.query_exists ())
+ continue;
+
+ if (directory.query_file_type (FileQueryInfoFlags.NOFOLLOW_SYMLINKS) !=
FileType.DIRECTORY)
+ continue;
+
var enumerator = directory.enumerate_children ("",
FileQueryInfoFlags.NOFOLLOW_SYMLINKS);
for (var info = enumerator.next_file () ; info != null ; info = enumerator.next_file
()) {
var module_info_basename = info.get_name ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]