From ffd4daea7cd95b24f03e38ac508fade220d6a224 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 10 Mar 2013 02:01:52 +0100 Subject: [PATCH] neutrino: fix most hardcoded paths --- src/driver/pictureviewer/pictureviewer.cpp | 2 +- src/eitd/SIlanguage.cpp | 3 +-- src/eitd/SIlanguage.hpp | 2 +- src/eitd/edvbstring.cpp | 2 +- src/eitd/sectionsd.cpp | 2 +- src/eitd/xmlutil.cpp | 4 ++-- src/gui/bookmarkmanager.h | 2 +- src/gui/keybind_setup.cpp | 2 +- src/gui/osdlang_setup.cpp | 2 +- src/gui/settings_manager.cpp | 2 +- src/nhttpd/tuxboxapi/coolstream/controlapi.cpp | 4 ++-- src/nhttpd/yconfig.h | 12 ++++++------ src/nhttpd/yhttpd_mods/Makefile.am | 1 + src/nhttpd/yhttpd_mods/mod_yparser.cpp | 2 ++ src/system/localize.cpp | 2 +- src/system/setting_helpers.cpp | 4 ++-- src/zapit/include/zapit/zapit.h | 4 ++-- 17 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 6660e2069..f71caa133 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -461,7 +461,7 @@ void CPictureViewer::getSize(const char* name, int* width, int *height) } } -#define LOGO_DIR1 "/share/tuxbox/neutrino/icons/logo" +#define LOGO_DIR1 DATADIR "/neutrino/icons/logo" #define LOGO_FMT ".jpg" bool CPictureViewer::GetLogoName(uint64_t channel_id, std::string ChannelName, std::string & name, int *width, int *height) diff --git a/src/eitd/SIlanguage.cpp b/src/eitd/SIlanguage.cpp index e6ec07ae8..4f251710d 100644 --- a/src/eitd/SIlanguage.cpp +++ b/src/eitd/SIlanguage.cpp @@ -22,6 +22,7 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ +#include #include #include #include @@ -32,8 +33,6 @@ #include "SIlanguage.hpp" -#define LANGUAGEFILE "/var/tuxbox/config/epglanguages.conf" - std::vector SIlanguage::languages; pthread_mutex_t SIlanguage::languages_lock = PTHREAD_MUTEX_INITIALIZER; diff --git a/src/eitd/SIlanguage.hpp b/src/eitd/SIlanguage.hpp index 133aec0fc..0c3c057bd 100644 --- a/src/eitd/SIlanguage.hpp +++ b/src/eitd/SIlanguage.hpp @@ -29,7 +29,7 @@ #include -#define LANGUAGEFILE "/var/tuxbox/config/epglanguages.conf" +#define LANGUAGEFILE CONFIGDIR "/epglanguages.conf" class SIlanguage { public: diff --git a/src/eitd/edvbstring.cpp b/src/eitd/edvbstring.cpp index 24882425e..010c3eaa3 100644 --- a/src/eitd/edvbstring.cpp +++ b/src/eitd/edvbstring.cpp @@ -17,7 +17,7 @@ std::set TransponderUseTwoCharMapping; int readEncodingFile() { - FILE *f = fopen("/var/tuxbox/config/encoding.conf", "rt"); + FILE *f = fopen(CONFIGDIR "/encoding.conf", "rt"); if (f) { CountryCodeDefaultMapping.clear(); TransponderDefaultMapping.clear(); diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 87e5e714e..fe1c09dbd 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -1692,7 +1692,7 @@ void CEitThread::beforeSleep() messaging_zap_detected = false; unlockMessaging(); if(notify_complete) - system("/var/tuxbox/config/epgdone.sh"); + system(CONFIGDIR "/epgdone.sh"); } /********************************************************************************/ diff --git a/src/eitd/xmlutil.cpp b/src/eitd/xmlutil.cpp index 1d794e63b..29b8bab5c 100644 --- a/src/eitd/xmlutil.cpp +++ b/src/eitd/xmlutil.cpp @@ -47,8 +47,8 @@ extern bool reader_ready; extern pthread_rwlock_t eventsLock; extern bool dvb_time_update; -std::string epg_filter_dir = "/var/tuxbox/config/zapit/epgfilter.xml"; -std::string dvbtime_filter_dir = "/var/tuxbox/config/zapit/dvbtimefilter.xml"; +std::string epg_filter_dir = CONFIGDIR "/zapit/epgfilter.xml"; +std::string dvbtime_filter_dir = CONFIGDIR "/zapit/dvbtimefilter.xml"; bool epg_filter_is_whitelist = false; bool epg_filter_except_current_next = false; diff --git a/src/gui/bookmarkmanager.h b/src/gui/bookmarkmanager.h index e1f88e02a..1e4a921a5 100644 --- a/src/gui/bookmarkmanager.h +++ b/src/gui/bookmarkmanager.h @@ -43,7 +43,7 @@ #include #define MAXBOOKMARKS 10 -#define BOOKMARKFILE "/var/tuxbox/config/bookmarks" +#define BOOKMARKFILE CONFIGDIR "/bookmarks" class CBookmark { diff --git a/src/gui/keybind_setup.cpp b/src/gui/keybind_setup.cpp index c2ce525a2..5dd5727fb 100644 --- a/src/gui/keybind_setup.cpp +++ b/src/gui/keybind_setup.cpp @@ -94,7 +94,7 @@ int CKeybindSetup::exec(CMenuTarget* parent, const std::string &actionKey) CFileFilter fileFilter; fileFilter.addFilter("conf"); fileBrowser.Filter = &fileFilter; - if (fileBrowser.exec("/var/tuxbox/config") == true) { + if (fileBrowser.exec(CONFIGDIR) == true) { CNeutrinoApp::getInstance()->loadKeys(fileBrowser.getSelectedFile()->Name.c_str()); printf("[neutrino keybind_setup] new keys: %s\n", fileBrowser.getSelectedFile()->Name.c_str()); } diff --git a/src/gui/osdlang_setup.cpp b/src/gui/osdlang_setup.cpp index 65f01eae6..c57cbce3e 100644 --- a/src/gui/osdlang_setup.cpp +++ b/src/gui/osdlang_setup.cpp @@ -169,7 +169,7 @@ void COsdLangSetup::showLanguageSetup(CMenuWidget *osdl_setup) struct dirent **namelist; int n; // printf("scanning locale dir now....(perhaps)\n"); - char *pfad[] = {(char *) DATADIR "/neutrino/locale",(char *) "/var/tuxbox/config/locale"}; + char *pfad[] = {(char *) DATADIR "/neutrino/locale",(char *) CONFIGDIR "/locale"}; osdl_setup->addIntroItems(); diff --git a/src/gui/settings_manager.cpp b/src/gui/settings_manager.cpp index c4aa9f735..3f938dd55 100644 --- a/src/gui/settings_manager.cpp +++ b/src/gui/settings_manager.cpp @@ -71,7 +71,7 @@ int CSettingsManager::exec(CMenuTarget* parent, const std::string &actionKey) { fileFilter.addFilter("conf"); fileBrowser.Filter = &fileFilter; - if (fileBrowser.exec("/var/tuxbox/config") == true) + if (fileBrowser.exec(CONFIGDIR) == true) { CNeutrinoApp::getInstance()->loadSetup(fileBrowser.getSelectedFile()->Name.c_str()); CColorSetupNotifier *colorSetupNotifier = new CColorSetupNotifier; diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 8df655346..5ed06d1a8 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -516,14 +516,14 @@ void CControlAPI::GetTimeCGI(CyhookHandler *hh) // send services.xml void CControlAPI::GetServicesxmlCGI(CyhookHandler *hh) { - hh->SendFile("/var/tuxbox/config/zapit/services.xml"); + hh->SendFile(CONFIGDIR "/zapit/services.xml"); } //----------------------------------------------------------------------------- // send bouquets.xml void CControlAPI::GetBouquetsxmlCGI(CyhookHandler *hh) { - hh->SendFile("/var/tuxbox/config/zapit/bouquets.xml"); + hh->SendFile(CONFIGDIR "/zapit/bouquets.xml"); } //----------------------------------------------------------------------------- diff --git a/src/nhttpd/yconfig.h b/src/nhttpd/yconfig.h index c248efcd0..7790cea2e 100644 --- a/src/nhttpd/yconfig.h +++ b/src/nhttpd/yconfig.h @@ -101,26 +101,26 @@ #define HTTPD_DEFAULT_LANGUAGE "English" #define AUTHUSER "root" -#define HTTPD_CONFIGDIR "/var/tuxbox/config" +#define HTTPD_CONFIGDIR CONFIGDIR #define HTTPD_CONFIGFILE HTTPD_CONFIGDIR "/nhttpd.conf" #define YWEB_CONFIGFILE HTTPD_CONFIGDIR "/Y-Web.conf" #define PUBLICDOCUMENTROOT "/var/httpd" -#define NEUTRINO_CONFIGFILE "/var/tuxbox/config/neutrino.conf" +#define NEUTRINO_CONFIGFILE CONFIGDIR "/neutrino.conf" #define HOSTEDDOCUMENTROOT "/mnt/hosted" #define EXTRASDOCUMENTROOT "/mnt/hosted/extras" #define EXTRASDOCUMENTURL "/hosted/extras" -#define ZAPITXMLPATH "/var/tuxbox/config/zapit" -#define TUXBOX_LOGOS_URL "/usr/share/tuxbox/neutrino/icons/logos" +#define ZAPITXMLPATH CONFIGDIR "/zapit" +#define TUXBOX_LOGOS_URL DATADIR "/neutrino/icons/logos" // switch for Box differences #ifdef CONFIG_SYSTEM_TUXBOX #define AUTHPASSWORD "dbox2" -#define PRIVATEDOCUMENTROOT "/share/tuxbox/neutrino/httpd-y" +#define PRIVATEDOCUMENTROOT DATADIR "/neutrino/httpd-y" #endif #ifdef CONFIG_SYSTEM_TUXBOX_COOLSTREAM #define AUTHPASSWORD "coolstream" -#define PRIVATEDOCUMENTROOT "/share/tuxbox/neutrino/httpd" +#define PRIVATEDOCUMENTROOT DATADIR "/neutrino/httpd" #undef Y_CONFIG_BUILD_AS_DAEMON // No Daemon #endif //----------------------------------------------------------------------------- diff --git a/src/nhttpd/yhttpd_mods/Makefile.am b/src/nhttpd/yhttpd_mods/Makefile.am index 74d213c4f..6f7f05823 100644 --- a/src/nhttpd/yhttpd_mods/Makefile.am +++ b/src/nhttpd/yhttpd_mods/Makefile.am @@ -1,4 +1,5 @@ INCLUDES = \ + -I$(top_builddir) \ -I$(top_srcdir)/lib \ -I$(top_srcdir)/src/zapit/include \ -I$(top_srcdir)/src \ diff --git a/src/nhttpd/yhttpd_mods/mod_yparser.cpp b/src/nhttpd/yhttpd_mods/mod_yparser.cpp index 3fd7a1c5e..b7995dc23 100644 --- a/src/nhttpd/yhttpd_mods/mod_yparser.cpp +++ b/src/nhttpd/yhttpd_mods/mod_yparser.cpp @@ -3,6 +3,8 @@ // yParser //============================================================================= // C +#include + #include #include #include diff --git a/src/system/localize.cpp b/src/system/localize.cpp index bed4a433a..220f0b3d4 100644 --- a/src/system/localize.cpp +++ b/src/system/localize.cpp @@ -111,7 +111,7 @@ CLocaleManager::~CLocaleManager() delete[] defaultData; } -const char * path[2] = {"/var/tuxbox/config/locale/", DATADIR "/neutrino/locale/"}; +const char * path[2] = { CONFIGDIR "/locale/", DATADIR "/neutrino/locale/"}; CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const locale, bool asdefault) { diff --git a/src/system/setting_helpers.cpp b/src/system/setting_helpers.cpp index 4385ff211..e959dd875 100644 --- a/src/system/setting_helpers.cpp +++ b/src/system/setting_helpers.cpp @@ -468,7 +468,7 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK return true; if(delete_all) { - my_system(3, "/bin/sh", "-c", "rm -f /var/tuxbox/config/zapit/*.conf"); + my_system(3, "/bin/sh", "-c", "rm -f " CONFIGDIR "/zapit/*.conf"); CServiceManager::getInstance()->SatelliteList().clear(); CZapit::getInstance()->LoadSettings(); CZapit::getInstance()->GetConfig(zapitCfg); @@ -488,7 +488,7 @@ int CDataResetNotifier::exec(CMenuTarget* /*parent*/, const std::string& actionK CFrameBuffer::getInstance()->Clear(); } if(delete_chan) { - my_system(3, "/bin/sh", "-c", "rm -f /var/tuxbox/config/zapit/*.xml"); + my_system(3, "/bin/sh", "-c", "rm -f " CONFIGDIR "/zapit/*.xml"); g_Zapit->reinitChannels(); } return ret; diff --git a/src/zapit/include/zapit/zapit.h b/src/zapit/include/zapit/zapit.h index 9bb814af9..a74ec82d3 100644 --- a/src/zapit/include/zapit/zapit.h +++ b/src/zapit/include/zapit/zapit.h @@ -21,8 +21,8 @@ #define PAL 0 #define NTSC 1 -#define AUDIO_CONFIG_FILE "/var/tuxbox/config/zapit/audio.conf" -#define VOLUME_CONFIG_FILE "/var/tuxbox/config/zapit/volume.conf" +#define AUDIO_CONFIG_FILE CONFIGDIR "/zapit/audio.conf" +#define VOLUME_CONFIG_FILE CONFIGDIR "/zapit/volume.conf" typedef std::map audio_map_t; typedef audio_map_t::iterator audio_map_iterator_t;