core: store presets, registry and plugins in XDG directories.

Presets and plugins moved to $XDG_DATA_HOME/gstreamer-0.11/
root directory. Registry moved to $XDG_CACHE_HOME/gstreamer-0.11/.

Fixes bug #518597.
This commit is contained in:
Philippe Normand 2011-04-29 13:43:07 +02:00 committed by Sebastian Dröge
parent 5fe9bcd989
commit 4e36f93924
4 changed files with 18 additions and 12 deletions

View file

@ -12,6 +12,11 @@ The 0.11 porting guide
* multifdsink, tcpclientsink, tcpclientsrc, tcpserversrc the protocol property
is removed, use gdppay and gdpdepay.
* Presets and plugins moved to $XDG_DATA_HOME/gstreamer-0.11/ root
directory. Registry moved to $XDG_CACHE_HOME/gstreamer-0.11/.
XDG_CACHE_HOME usually points to $HOME/.cache and XDG_DATA_HOME
usually is $HOME/.local/share/.
* GstObject:
GST_OBJECT_DISPOSING flag removed
GST_OBJECT_IS_DISPOSING removed

View file

@ -141,9 +141,9 @@ preset_get_paths (GstPreset * preset, const gchar ** preset_user_path,
if (!(preset_path = g_type_get_qdata (type, preset_user_path_quark))) {
gchar *preset_dir;
/* user presets go in '$HOME/.gstreamer-0.10/presets/GstSimSyn.prs' */
preset_dir = g_build_filename (g_get_home_dir (),
".gstreamer-" GST_MAJORMINOR, "presets", NULL);
/* user presets go in user's XDG data directory. */
preset_dir = g_build_filename (g_get_user_data_dir (),
"gstreamer-" GST_MAJORMINOR, "presets", NULL);
GST_INFO_OBJECT (preset, "user_preset_dir: '%s'", preset_dir);
preset_path =
g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s.prs", preset_dir,

View file

@ -1509,8 +1509,9 @@ scan_and_update_registry (GstRegistry * default_registry,
/* plugins in the user's home directory take precedence over
* system-installed ones */
home_plugins = g_build_filename (g_get_home_dir (),
".gstreamer-" GST_MAJORMINOR, "plugins", NULL);
home_plugins = g_build_filename (g_get_user_data_dir (),
"gstreamer-" GST_MAJORMINOR, "plugins", NULL);
GST_DEBUG ("scanning home plugins %s", home_plugins);
changed |= gst_registry_scan_path_internal (&context, home_plugins);
g_free (home_plugins);
@ -1589,8 +1590,8 @@ ensure_current_registry (GError ** error)
default_registry = gst_registry_get_default ();
registry_file = g_strdup (g_getenv ("GST_REGISTRY"));
if (registry_file == NULL) {
registry_file = g_build_filename (g_get_home_dir (),
".gstreamer-" GST_MAJORMINOR, "registry." HOST_CPU ".bin", NULL);
registry_file = g_build_filename (g_get_user_cache_dir (),
"gstreamer-" GST_MAJORMINOR, "registry." HOST_CPU ".bin", NULL);
}
if (!_gst_disable_registry_cache) {

View file

@ -248,8 +248,8 @@ remove_preset_file (void)
{
gchar *preset_file_name;
preset_file_name = g_build_filename (g_get_home_dir (),
".gstreamer-" GST_MAJORMINOR, "presets", "GstPresetTest.prs", NULL);
preset_file_name = g_build_filename (g_get_user_data_dir (),
"gstreamer-" GST_MAJORMINOR, "presets", "GstPresetTest.prs", NULL);
g_unlink (preset_file_name);
g_free (preset_file_name);
}
@ -281,9 +281,9 @@ gst_preset_suite (void)
gchar *gst_dir;
gboolean can_write = FALSE;
/* cehck if we can create presets */
gst_dir = g_build_filename (g_get_home_dir (),
".gstreamer-" GST_MAJORMINOR, NULL);
/* check if we can create presets */
gst_dir = g_build_filename (g_get_user_data_dir (),
"gstreamer-" GST_MAJORMINOR, NULL);
can_write = (g_access (gst_dir, R_OK | W_OK | X_OK) == 0);
g_free (gst_dir);