From 75b4f557b454afb8f694d078f7f7dca58cfdba3d Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 23 Sep 2015 14:20:08 +0200 Subject: [PATCH] run: Add /var/config and /var/data to sandbox These point to the per-app data subdirectories. They are useful alternatives to the $HOME based names because they have fixed names, and can be used in e.g. symlinks. --- app/xdg-app-builtins-run.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/xdg-app-builtins-run.c b/app/xdg-app-builtins-run.c index 07cf7b31..1ababbbe 100644 --- a/app/xdg-app-builtins-run.c +++ b/app/xdg-app-builtins-run.c @@ -68,6 +68,8 @@ xdg_app_builtin_run (int argc, char **argv, GCancellable *cancellable, GError ** g_autoptr(GFile) runtime_files = NULL; g_autoptr(GFile) app_id_dir = NULL; g_autoptr(GFile) app_cache_dir = NULL; + g_autoptr(GFile) app_data_dir = NULL; + g_autoptr(GFile) app_config_dir = NULL; g_autoptr(GFile) home = NULL; g_autoptr(GFile) user_font1 = NULL; g_autoptr(GFile) user_font2 = NULL; @@ -189,9 +191,17 @@ xdg_app_builtin_run (int argc, char **argv, GCancellable *cancellable, GError ** goto out; app_cache_dir = g_file_get_child (app_id_dir, "cache"); - g_ptr_array_add (argv_array, g_strdup ("-b")); + g_ptr_array_add (argv_array, g_strdup ("-B")); g_ptr_array_add (argv_array, g_strdup_printf ("/var/cache=%s", gs_file_get_path_cached (app_cache_dir))); + app_data_dir = g_file_get_child (app_id_dir, "data"); + g_ptr_array_add (argv_array, g_strdup ("-B")); + g_ptr_array_add (argv_array, g_strdup_printf ("/var/data=%s", gs_file_get_path_cached (app_data_dir))); + + app_config_dir = g_file_get_child (app_id_dir, "config"); + g_ptr_array_add (argv_array, g_strdup ("-B")); + g_ptr_array_add (argv_array, g_strdup_printf ("/var/config=%s", gs_file_get_path_cached (app_config_dir))); + app_files = xdg_app_deploy_get_files (app_deploy); runtime_files = xdg_app_deploy_get_files (runtime_deploy);