[mythtv] [mythtv-commits] Ticket #4593: /.mythtv/ should *not* get created (blank homedir)
andrei at tanas.ca
Wed Feb 6 20:14:49 UTC 2008
> > > On Wednesday 06 February 2008 15:13:47 MythTV wrote:
> > >
> > >> Even though QDir::homeDirPath() will use other environment
> > >> variables on Windows when HOME is not set, libdvdnav needs HOME,
> > >> and segfaults without it.
> > >
> > > So the logical fix would be to use the output from
> > > QDir::homeDirPath() in libdvdnav somehow? Seems to be a lot easier
> > > than finding a way to set HOME in windows.
> > It would be I guess, I wrote the patch before this issue was raised.
> > I thing that getting the value using QDir::homeDirPath() is fine,
> > I actually think that it makes sense to set the environment
> > any processes launched by mythfrontend/mythbackend will inherit it
> > just in case they need it too.
> Would just setting the variable using the QDir::homeDirPath() value
> using the Windows/mingw equivalent of setenv or something) work?
I looked at the QT code and I don't really like the way they implemented
QDir::homeDirPath() for Win32. It tries to use (in order) HOME, USERPROFILE,
HOMEDRIVE+HOMEPATH. Now, typically:
- HOME is not set
- USERPROFILE is set to user's top level folder (not the "application data"
which under Vista may not
- HOMEDRIVE is usually "C:", HOMEPATH is "\"
I think LOCALAPPDATA variable is most suitable. If we set it early (see my
then QDir::homeDirPath() will also return the same value (since it tries to
use HOME first).
PS. it is necessary to use _putenv() in Win32, the closest analog
SetEnvironmentVariable() appears to work, but getenv() called from the same
process does not see it.
More information about the mythtv-dev