Ticket #4874: mythcontext.patch4

File mythcontext.patch4, 1.2 KB (added by anonymous, 18 years ago)
Line 
1Index: libs/libmyth/mythcontext.cpp
2===================================================================
3--- libs/libmyth/mythcontext.cpp (revision 16312)
4+++ libs/libmyth/mythcontext.cpp (working copy)
5@@ -352,6 +352,29 @@
6 QDir prefixDir(appPath.left(appPath.findRev("/")));
7 #endif
8
9+#ifdef _WIN32
10+ // LIBDIR might not be defined
11+ // some libraries will fail without it
12+
13+ char *tmp_libdir = getenv("MYTHLIBDIR");
14+ if (!tmp_libdir) {
15+ char * localappdata= getenv("LOCALAPPDATA"); // Vista
16+ if (!localappdata)
17+ localappdata = getenv("APPDATA"); // XP
18+ if (!localappdata)
19+ m_installlibdir = ".\\lib"; // getenv("TEMP")?
20+ else
21+ m_installlibdir = localappdata + QString("\\mythtv");
22+
23+ _putenv(QString("MYTHLIBDIR=%1").arg(m_installlibdir));
24+ } else
25+ m_installlibdir = tmp_libdir;
26+
27+ VERBOSE(VB_IMPORTANT, QString("Using runtime prefix = %1, libdir = %2 Prefixdir= %3")
28+ .arg(m_installprefix).arg(m_installlibdir).arg(prefixDir.canonicalPath()));
29+
30+#endif
31+
32 if (QDir(m_installprefix).isRelative())
33 {
34 // If the PREFIX is relative, evaluate it relative to our