From fbe5dd10e7f576b74bc9921a5ff5d0ce190002bc Mon Sep 17 00:00:00 2001 From: psychon Date: Thu, 13 May 2010 16:51:17 +0000 Subject: [PATCH] Move module templates to DATADIR The file hierarchy standard wants that! git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1982 726aef4b-f618-498e-8847-2d620e286838 --- Makefile.in | 4 +++- WebModules.cpp | 6 ++++++ main.h | 8 ++++---- modules/Makefile.in | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile.in b/Makefile.in index 95ed1911..826c0141 100644 --- a/Makefile.in +++ b/Makefile.in @@ -19,6 +19,7 @@ LIBS := @LIBS@ LIBZNC := @LIBZNC@ LIBZNCDIR:= @LIBZNCDIR@ MODDIR := @MODDIR@ +DATADIR := @DATADIR@ PKGCONFIGDIR := $(libdir)/pkgconfig LIB_SRCS := ZNCString.cpp Csocket.cpp znc.cpp User.cpp IRCSock.cpp Client.cpp DCCBounce.cpp \ @@ -72,7 +73,8 @@ install: znc $(LIBZNC) mkdir -p $(DESTDIR)$(includedir)/znc mkdir -p $(DESTDIR)$(PKGCONFIGDIR) mkdir -p $(DESTDIR)$(MODDIR) - cp -Rp webskins $(DESTDIR)$(MODDIR) + mkdir -p $(DESTDIR)$(DATADIR) + cp -Rp webskins $(DESTDIR)$(DATADIR) install -m 0755 znc $(DESTDIR)$(bindir) install -m 0755 znc-config $(DESTDIR)$(bindir) install -m 0755 znc-buildmod $(DESTDIR)$(bindir) diff --git a/WebModules.cpp b/WebModules.cpp index 7a1251c3..db95ffe1 100644 --- a/WebModules.cpp +++ b/WebModules.cpp @@ -454,6 +454,12 @@ CString CWebSock::GetModWebPath(const CModule* pModule) const { // ...and set sModDir to the dir in which sModPath resides CString sModDir = sModPath.substr(0, pos); + // Check if module is loaded from ~/.znc/modules or from source or from installed prefix + if (sModDir.Equals(_MODDIR_)) { + // Loaded from installed prefix + return CString(_DATADIR_) + "/www/" + pModule->GetModName(); + } + return sModDir + "/www/" + pModule->GetModName(); } diff --git a/main.h b/main.h index 5bbdf163..7a4c690e 100644 --- a/main.h +++ b/main.h @@ -24,14 +24,14 @@ #define _MODDIR_ "/usr/lib/znc" #endif -#ifndef _SKINDIR_ -#define _SKINDIR_ _MODDIR_ "/webskins" -#endif - #ifndef _DATADIR_ #define _DATADIR_ "/usr/share/znc" #endif +#ifndef _SKINDIR_ +#define _SKINDIR_ _DATADIR_ "/webskins" +#endif + #define MODULECALL(macFUNC, macUSER, macCLIENT, macEXITER) \ if (macUSER) { \ CGlobalModules& GMods = CZNC::Get().GetModules(); \ diff --git a/modules/Makefile.in b/modules/Makefile.in index cad46806..eff77764 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -92,7 +92,7 @@ create_install_dir: rm -rf $(DESTDIR)$(MODDIR)/*.so install_metadirs: create_install_dir - cp -Rp $(srcdir)/www $(DESTDIR)$(MODDIR) + cp -Rp $(srcdir)/www $(DESTDIR)$(DATADIR) for a in $(srcdir)/*; do \ d=$$(echo $$a | sed -e "s:$(srcdir)/::g"); \ if [ -d $$a ] && [ -f $${d}.so ]; then \