context: Change to home directory during setup

Is currently done during meta_init().

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>
This commit is contained in:
Jonas Ådahl 2021-03-02 11:59:39 +01:00
parent 6f4b973329
commit a32b005848

View File

@ -127,6 +127,19 @@ init_signal_handlers (MetaContext *context)
g_unix_signal_add (SIGTERM, on_sigterm, 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 * static const char *
compositor_type_to_description (MetaCompositorType compositor_type) compositor_type_to_description (MetaCompositorType compositor_type)
{ {
@ -164,6 +177,8 @@ meta_context_setup (MetaContext *context,
init_signal_handlers (context); init_signal_handlers (context);
change_to_home_directory ();
compositor_type = meta_context_get_compositor_type (context); compositor_type = meta_context_get_compositor_type (context);
g_message ("Running %s (using mutter %s) as a %s", g_message ("Running %s (using mutter %s) as a %s",
priv->name, VERSION, priv->name, VERSION,