From a32b005848268a6c81c1adaf7f7b4f1d36f692ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 2 Mar 2021 11:59:39 +0100 Subject: [PATCH] context: Change to home directory during setup Is currently done during meta_init(). Part-of: --- 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 abdd496a4..80e6e0676 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,