Ticket #4984: mythcontext.patch6

File mythcontext.patch6, 3.6 KB (added by arnonm@…, 16 years ago)

Replaces existing patches and incoporates changes from 4973

Line 
1Index: libs/libmyth/mythcontext.cpp
2===================================================================
3--- libs/libmyth/mythcontext.cpp        (revision 16468)
4+++ libs/libmyth/mythcontext.cpp        (working copy)
5@@ -341,9 +341,6 @@
6       display_res(NULL),
7       useSettingsCache(false)
8 {
9-    char *tmp_installprefix = getenv("MYTHTVDIR");
10-    if (tmp_installprefix)
11-        m_installprefix = tmp_installprefix;
12 
13 #if QT_VERSION >= 0x030200
14     QDir prefixDir = qApp->applicationDirPath();
15@@ -352,6 +349,30 @@
16     QDir prefixDir(appPath.left(appPath.findRev("/")));
17 #endif
18 
19+    char *tmp_installprefix = getenv("MYTHTVDIR");
20+    if (tmp_installprefix)
21+        m_installprefix = tmp_installprefix;
22+#ifdef _WIN32
23+    else {
24+       m_installprefix = prefixDir.canonicalPath();
25+       _putenv(QString("MYTHTVDIR=%1").arg(m_installprefix));         
26+       
27+    }
28+    // LIBDIR might not be defined
29+    // some libraries will fail without it
30+
31+       char *tmp_libdir = getenv("MYTHLIBDIR");
32+       if (!tmp_libdir) {
33+               m_installlibdir = prefixDir.canonicalPath()+ QString("/lib"); ;
34+               _putenv(QString("MYTHLIBDIR=%1").arg(m_installlibdir));   
35+       } else
36+           m_installlibdir = tmp_libdir;
37+
38+    VERBOSE(VB_FILE, QString("Using runtime prefix = %1, libdir = %2 Prefixdir= %3")
39+                          .arg(m_installprefix).arg(m_installlibdir).arg(prefixDir.canonicalPath()));
40+
41+#endif
42+
43     if (QDir(m_installprefix).isRelative())
44     {
45         // If the PREFIX is relative, evaluate it relative to our
46@@ -370,8 +391,15 @@
47             m_installlibdir = prefixDir.canonicalPath() + "/lib";
48     }
49 
50-    VERBOSE(VB_IMPORTANT, QString("Using runtime prefix = %1, libdir = %2")
51-                          .arg(m_installprefix).arg(m_installlibdir));
52+    VERBOSE(VB_FILE, QString("m_installprefix= %1")
53+                          .arg(m_installprefix));
54+
55+    VERBOSE(VB_FILE, QString("m_installlibdir = %1")
56+                          .arg(m_installlibdir));
57+
58+    VERBOSE(VB_FILE, QString("prefixDir= %1")
59+                          .arg(prefixDir.canonicalPath()));
60+
61 }
62 
63 MythContextPrivate::~MythContextPrivate()
64@@ -1500,6 +1528,33 @@
65 
66     d = new MythContextPrivate(this);
67     assert(d);
68+   
69+
70+   
71+    VERBOSE(VB_FILE, QString("ShareDir = %1")
72+                          .arg(GetShareDir()));
73+   
74+    VERBOSE(VB_FILE, QString("LibDir = %1")
75+                          .arg(GetLibraryDir()));
76+
77+    VERBOSE(VB_FILE, QString("ThemesParentDir=%1")
78+                          .arg(GetThemesParentDir()));
79+
80+    VERBOSE(VB_FILE, QString("PluginsDir=%1")
81+                          .arg(GetPluginsDir()));
82+
83+    VERBOSE(VB_FILE, QString("TranslationsDir=%1")
84+                          .arg(GetTranslationsDir()));
85+
86+    VERBOSE(VB_FILE, QString("FontsDir = %1")
87+                          .arg(GetFontsDir()));
88+
89+    VERBOSE(VB_FILE, QString("FiltersDir = %1")
90+                          .arg(GetFiltersDir()));
91+
92+    VERBOSE(VB_FILE, QString("ConfDir =%1")
93+                          .arg(GetConfDir()));
94+
95 }
96 
97 bool MythContext::Init(const bool gui, UPnp *UPnPclient,
98@@ -1533,13 +1588,17 @@
99     if (!home)
100     {
101         home = getenv("LOCALAPPDATA");      // Vista
102-        if (!home)
103+        if (!home)
104             home = getenv("APPDATA");       // XP
105-        if (!home)
106+        if (!home)
107             home = ".";  // getenv("TEMP")?
108-
109+           
110         _putenv(QString("HOME=%1").arg(home));
111     }
112+    char *mythconfdir = getenv("MYTHCONFDIR");
113+    if (!mythconfdir)
114+       _putenv(QString("MYTHCONFDIR=%1/mythtv").arg(home));   
115+       
116 #endif
117 
118     if (QDir::homeDirPath() == "/" && ! getenv("MYTHCONFDIR"))