[mutter] context: Change to home directory during setup



commit a32b005848268a6c81c1adaf7f7b4f1d36f692ee
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Tue Mar 2 11:59:39 2021 +0100

    context: Change to home directory during setup
    
    Is currently done during meta_init().
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>

 src/core/meta-context.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
---
diff --git a/src/core/meta-context.c b/src/core/meta-context.c
index abdd496a4a..80e6e06764 100644
--- a/src/core/meta-context.c
+++ b/src/core/meta-context.c
@@ -127,6 +127,19 @@ init_signal_handlers (MetaContext *context)
   g_unix_signal_add (SIGTERM, on_sigterm, context);
 }
 
+static void
+change_to_home_directory (void)
+{
+  const char *home_dir;
+
+  home_dir = g_get_home_dir ();
+  if (!home_dir)
+    return;
+
+  if (chdir (home_dir) < 0)
+    g_warning ("Could not change to home directory %s", home_dir);
+}
+
 static const char *
 compositor_type_to_description (MetaCompositorType compositor_type)
 {
@@ -164,6 +177,8 @@ meta_context_setup (MetaContext  *context,
 
   init_signal_handlers (context);
 
+  change_to_home_directory ();
+
   compositor_type = meta_context_get_compositor_type (context);
   g_message ("Running %s (using mutter %s) as a %s",
              priv->name, VERSION,


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