From 2a73b7289d44cad95e0ad4760240bb645dd58e78 Mon Sep 17 00:00:00 2001 From: Gildas Bazin Date: Fri, 30 Apr 2004 15:30:43 +0000 Subject: [PATCH] * share/skins2/skin.catalog: added a default catalog as some platforms don't provide one (eg. win32). * modules/gui/skins2/parser/skin_parser.cpp: try to load the skins catalog and if it fails, use the system's one. --- Makefile.am | 3 +++ modules/gui/skins2/parser/skin_parser.cpp | 23 ++++++++++++++++++++--- share/Makefile.am | 1 + share/skins2/skin.catalog | 4 ++++ 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 share/skins2/skin.catalog diff --git a/Makefile.am b/Makefile.am index e4c40933fc..48d6661a8a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -621,6 +621,9 @@ package-win32-base: for i in $(srcdir)/share/skins2/default/*.*; do \ cp $$i $(srcdir)/vlc-${VERSION}/skins2/default/ || true ; \ done + for i in $(srcdir)/share/skins2/*.*; do \ + cp $$i $(srcdir)/vlc-${VERSION}/skins2/ || true ; \ + done mkdir -p "$(srcdir)/vlc-${VERSION}/http/admin" cp $(srcdir)/share/http/*.html $(srcdir)/vlc-${VERSION}/http/ ; diff --git a/modules/gui/skins2/parser/skin_parser.cpp b/modules/gui/skins2/parser/skin_parser.cpp index ed644c3df4..d06e260f3b 100644 --- a/modules/gui/skins2/parser/skin_parser.cpp +++ b/modules/gui/skins2/parser/skin_parser.cpp @@ -42,15 +42,31 @@ SkinParser::SkinParser( intf_thread_t *pIntf, const string &rFileName, // Avoid duplicate initialization (mutex needed ?) if( !m_initialized ) { - // Initialize XML catalog support - xmlInitializeCatalog(); - // Get the resource path and look for the DTD OSFactory *pOSFactory = OSFactory::instance( getIntf() ); const list &resPath = pOSFactory->getResourcePath(); const string &sep = pOSFactory->getDirSeparator(); list::const_iterator it; struct stat statBuf; + + // Try to load the catalog first (needed at least on win32 where + // we don't have a default catalog) + for( it = resPath.begin(); it != resPath.end(); it++ ) + { + string catalog_path = (*it) + sep + "skin.catalog"; + if( !stat( catalog_path.c_str(), &statBuf ) ) + { + msg_Dbg( getIntf(), "Using catalog %s", catalog_path.c_str() ); + xmlLoadCatalog( catalog_path.c_str() ); + break; + } + } + if( it == resPath.end() ) + { + // Ok, try the default one + xmlInitializeCatalog(); + } + for( it = resPath.begin(); it != resPath.end(); it++ ) { string path = (*it) + sep + "skin.dtd"; @@ -58,6 +74,7 @@ SkinParser::SkinParser( intf_thread_t *pIntf, const string &rFileName, { // DTD found msg_Dbg( getIntf(), "Using DTD %s", path.c_str() ); + // Add an entry in the default catalog xmlCatalogAdd( (xmlChar*)"public", (xmlChar*)("-//VideoLAN//DTD VLC Skins V" diff --git a/share/Makefile.am b/share/Makefile.am index 7fecca51b1..ceca858ec7 100644 --- a/share/Makefile.am +++ b/share/Makefile.am @@ -209,6 +209,7 @@ DIST_skins2 = \ \ skins2/fonts/FreeSans.ttf \ skins2/skin.dtd \ + skins2/skin.catalog \ $(NULL) DIST_http = \ diff --git a/share/skins2/skin.catalog b/share/skins2/skin.catalog new file mode 100644 index 0000000000..514174a24e --- /dev/null +++ b/share/skins2/skin.catalog @@ -0,0 +1,4 @@ + + + + \ No newline at end of file -- 2.39.5