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 \