[mythtv] [PATCH] Add support for specifying directory to use
forconfiguration
Jeremiah Morris
jm at whpress.com
Sun Feb 13 17:42:56 UTC 2005
On Feb 13, 2005, at 12:15 PM, Neulinger, Nathan wrote:
>> - Instead of a global variable (especially one without a "g" or other
>> prefix to make it obvious), just add a MythContext method, similar to
>> GetShareDir() -- maybe GetConfDir().
>
> I thought along those lines originally, but it looked to me like it was
> a chicken/egg issue since currently all of the path selection for
> .mythtv
> dir is done prior to creating the context object.
It can be a static routine, so you just call it as
MythContext::GetConfDir() instead of gContext->GetConfDir(). Then you
don't have to wait for gContext to be created.
>> - Allow absolute paths instead of confining it to the home directory.
>> You can always set it to "$HOME/.mythtv-fullscreen" or
>> whatever, but it
>> should be more flexible.
>
> Fair enough, will be quite a bit larger patch though.
I don't see why. The users just call MythContext::GetConfDir() +
"themecache" or whatever. The body of GetConfDir is basically:
if ($MYTHCONFDIR is set)
return $MYTHCONFDIR + "/"
else
return QDir::getHomeDir() + "/.mythtv/"
> What do you think - if starts with a /, is absolute, otherwise assume
> relative to homedir?
No need to get so complicated -- just require an absolute path. It's
not difficult to say:
export MYTHCONFDIR=$HOME/.mythtv-fullscreen
If it's relative, then it should get evaluated relative to the working
directory, I think that matches expectations better than choosing the
home directory. It also has the advantage of taking zero lines of code
to accept both absolute and relative paths gracefully.
>> - MythContext accepts an environment variable to change the install
>> prefix (used by GetShareDir() and others), so perhaps the conf dir
>> should be set by an environment variable too. That way, you
>> don't have
>> to add separate patches for mythfrontend, setup, etc.
>
> I'll look at adding that, and also updating the usage output, since I
> forgot to add something there.
While you're at it, can you mention something about MYTHTVDIR as well?
That's the one I mentioned for the prefix directory -- it gets used in
the constructor for MythContextPrivate. I had no idea that existed
until I went in to add it, so it would be nice to have both of these
documented.
- Jer
More information about the mythtv-dev
mailing list