[gnome-video-arcade] Do not monitor non-existent directories.



commit 89b72be116cbcdd7907d399f51c5ec0868664cf3
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Jun 22 19:51:14 2011 -0400

    Do not monitor non-existent directories.
    
    Do not create a GFileMonitor for a directory that doesn't exist.  This
    doesn't seem to be an issue on Linux, but on OpenBSD at least the file
    monitor trips immediately with a G_FILE_MONITOR_EVENT_DELETED, which
    causes GVA to ask on startup if it should re-analyze ROMs.
    
    What exposed this issue was the fact that the MAME package on OpenBSD
    includes $HOME/.mame/roms in the default ROM path, but that directory
    will not exist in a newly-created user account.
    
    Related to GNOME bug #652465.

 src/main.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 146ca39..533b3c8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -214,6 +214,10 @@ setup_file_monitors (void)
                 GFileMonitor *monitor;
                 GFile *file;
 
+                /* Skip paths that don't exist or are not directories. */
+                if (!g_file_test (search_paths[ii], G_FILE_TEST_IS_DIR))
+                        continue;
+
                 file = g_file_new_for_path (search_paths[ii]);
                 monitor = g_file_monitor (file, 0, NULL, NULL);
                 g_object_unref (file);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]