Comment 11 for bug 400830

Revision history for this message
A. Walton (awalton) wrote :

Or, g_file_monitor().

test for existence, if it doesn't exist, unshare (obviously). if it does
GFileMonitor *monitor = g_file_monitor (the_shared_directory, ...);
g_signal_connect (monitor, "changed", monitor_cb, ...);
...
static void
monitor_cb (GFileMonitor *monitor, GFile *file, GFile *unused, GFileMonitorEvent event, gpointer user_data)
{
  switch (event)
   {
    case G_FILE_MONITOR_EVENT_DELETED:
       unshare folder
       break;
   }
}

Or the inotify/fam/fsnotify/other file monitoring APIs in your language binding, or if you're really desperate (read: don't be this desperate; g_file_monitor() has a polling backend for desperate, no-native-file-monitoring platforms), check on startup and poll. This will work even if the folder is rmdir'd.