Skip to content
  • Allison Karlitskaya's avatar
    GDesktopAppInfo: avoid inotify on missing dirs · 3b8bc8ba
    Allison Karlitskaya authored
    Some desktop file directories, like /usr/local/share/applications may be
    missing on some systems.
    
    When we try to inotify on these directories, this will result in a
    every-4-seconds poll being setup which is quite bad.
    
    This is an issue that should be fixed in inotify itself but the problem
    is much larger there.  For now, we can work around it in GDesktopAppInfo
    by refusing to monitor missing directories.
    
    We may get some spurious notifications of changes in the case that
    /usr/local/share or /usr/local/share/applications is created without
    actually adding desktop files, but spurious changes can already be
    reported in other cases, so that's OK.  We won't get (user-visible)
    notification for a simple case of a completely unrelated file being
    created (however we cannot avoid the wakeup in this case due to how
    inotify works).  That's probably pretty theoretical, though, since files
    in /usr don't change much and for the home directory we're likely to
    have at least ~/.config and ~/.local existing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=736350
    3b8bc8ba