summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-04-14 15:29:59 +0200
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-04-14 15:29:59 +0200
commit50775180cf63cc4bf9f83fedf3808c9480a3c1f4 (patch)
treed4e101c71d02cd27d0ca61d82926cf11031c96c4
parent0feaafa47859ce4ada9c18dbf61404245f49d19a (diff)
downloadxine-lib-50775180cf63cc4bf9f83fedf3808c9480a3c1f4.tar.gz
xine-lib-50775180cf63cc4bf9f83fedf3808c9480a3c1f4.tar.bz2
Don't save the fake win32 registry in ~/.xine hardcoded, use XDG_CACHE_HOME.
-rw-r--r--src/libw32dll/Makefile.am5
-rw-r--r--src/libw32dll/wine/registry.c39
2 files changed, 13 insertions, 31 deletions
diff --git a/src/libw32dll/Makefile.am b/src/libw32dll/Makefile.am
index 358eea40a..367dc3bda 100644
--- a/src/libw32dll/Makefile.am
+++ b/src/libw32dll/Makefile.am
@@ -14,7 +14,9 @@ xineplug_LTLIBRARIES = $(w32dll_codec) $(qt_codec)
EXTRA_DIST = common.c
xineplug_decode_w32dll_la_SOURCES = w32codec.c
+xineplug_decode_w32dll_la_CFLAGS = $(AM_CFLAGS) $(XDG_BASEDIR_CFLAGS)
xineplug_decode_w32dll_la_LDFLAGS = -avoid-version -module
+xineplug_decode_w32dll_la_DEPS = $(XDG_BASEDIR_DEPS)
xineplug_decode_w32dll_la_LIBADD = \
$(top_builddir)/src/libw32dll/wine/libwine.la \
$(XINE_LIB) \
@@ -22,7 +24,8 @@ xineplug_decode_w32dll_la_LIBADD = \
-lm \
$(top_builddir)/src/libw32dll/DirectShow/libds_filter.la \
$(top_builddir)/src/libw32dll/dmo/libdmo_filter.la \
- @KSTAT_LIBS@
+ @KSTAT_LIBS@ \
+ $(XDG_BASEDIR_LIBS)
xineplug_decode_qt_la_SOURCES = qt_decoder.c
xineplug_decode_qt_la_LDFLAGS = -avoid-version -module
diff --git a/src/libw32dll/wine/registry.c b/src/libw32dll/wine/registry.c
index 0f91499b3..b47812018 100644
--- a/src/libw32dll/wine/registry.c
+++ b/src/libw32dll/wine/registry.c
@@ -19,6 +19,7 @@
#ifdef XINE_MAJOR
#include "xineutils.h"
+#include <basedir.h>
#endif
//#undef TRACE
@@ -302,44 +303,22 @@ static struct reg_value* insert_reg_value(int handle, const char* name, int type
static void init_registry(void)
{
+ xdgHandle tmph = xdgAllocHandle();
+ const char *const xdg_cache_home = xdgCacheHome(tmph);
+
TRACE("Initializing registry\n");
// can't be free-ed - it's static and probably thread
// unsafe structure which is stored in glibc
-#ifdef MPLAYER
- regpathname = get_path("registry");
- localregpathname = regpathname;
-#else
-#ifdef XINE_MAJOR
- localregpathname = (char *)malloc(strlen(xine_get_homedir()) + 21);
- sprintf(localregpathname, "%s/.xine/win32registry", xine_get_homedir());
-#else
- // regpathname is an external pointer
- //
- // registry.c is holding it's own internal pointer
- // localregpathname - which is being allocate/deallocated
-
- if (localregpathname == 0)
- {
- const char* pthn = regpathname;
- if (!regpathname)
- {
- // avifile - for now reading data from user's home
- struct passwd* pwent;
- pwent = getpwuid(geteuid());
- pthn = pwent->pw_dir;
- }
-
- localregpathname = (char*)malloc(strlen(pthn)+20);
- strcpy(localregpathname, pthn);
- strcat(localregpathname, "/.registry");
- }
-#endif
-#endif
+ localregpathname = malloc(strlen(xdg_cache_home) + sizeof("/"PACKAGE"/win32registry"));
+ strcpy(localregpathname, xdg_cache_home);
+ strcat(localregpathname, "/"PACKAGE"/win32registry")
open_registry();
insert_handle(HKEY_LOCAL_MACHINE, "HKLM");
insert_handle(HKEY_CURRENT_USER, "HKCU");
+
+ xdgFreeHandle(tmph);
}
#if 0