Jean-Marc Lasgouttes wrote:
> Angus> Jean-Marc Lasgouttes wrote:
> Angus> It'd simply be different. You'd have to iron out bugs in this
> Angus> new code too... I know that the changes to LyX 1.3.6 were
> huge Angus> but we did *try* to keep them to a minimum, remember?
> But having to run configure as install time was a big problem as I
> remember it.
Right. That's the PITA I was referring to in my original response.
However, the fact is that we need a unix shell environment to be
available to use LyX ATM. People who fail to install LyX properly
because it can't be found are still going to be people who can't use
LyX in your proposal.
What I'm trying to say is that some code currently exists that appears
to work for most people most of the time. I just don't know how much
work it would be to get a new system up and running in a robust
manner. My feeling is that it's not something that the LyX 1.3 series
should be too worried about.
> Angus> Having said that, I do think that your proposal is elegant.
> Angus> Presumably the order in which these files would be read would
> Angus> be
> Angus> $LYX_USER_DIR/lyxrc.defaults $LYX_SYSTEM_DIR/preferences
> Angus> $LYX_USER_DIR/preferences
> Angus> ? Ie, lyx would read three preferences files, not two as now.
> Well, my intent was to read $LYX_SYSTEM_DIR/preferences only when
> $LYX_USER_DIR/preferences did not exist (for new users). I think it
> is simpler to apprehend.
Comprehend. Apprehend is what policemen do when they catch a criminal.
It always makes me laugh when I read the French ;-)
(What follows is probably the ramblings of a sleep-deprived new
father. If you think it'll be trivial to implement your suggestion
that's great. Personally, I see things to think about.)
I can see how to read data with your suggestion. Something like:
boost::filesystem::path const lyxrc_defaults =
lyx::package::user_support_dir() / "lyxrc.defaults";
if (!exists(lyxrc_defaults))
exit(1);
LyXRC system_lyxrc;
read_lyxrc(lyxrc_defaults, system_lyxrc);
LyXRC user_lyxrc = system_lyxrc;
boost::filesystem::path preferences =
lyx::package::user_support_dir() / "preferences";
if (exists(preferences))
read_lyxrc(preferences, user_lyxrc);
else {
preferences =
lyx::package::system_support_dir() / "preferences";
if (exists(preferences))
read_lyxrc(preferences, user_lyxrc);
}
However, it's less clear how to write out a user preferences file only
if it differs from some combination of
lyx::package::user_support_dir() / "lyxrc.defaults";
and
lyx::package::system_support_dir() / "preferences"
In fact you'll probably need a third LyXRC variable:
LyXRC system_prefs = system_lyxrc;
boost::filesystem::path system_preferences =
lyx::package::system_support_dir() / "preferences";
if (exists(system_preferences))
read_lyxrc(system_preferences, system_prefs);
Now you can compare system_prefs and user_lyxrc when writing out
lyx::package::user_support_dir() / "preferences";
> Angus> Note that such a change would have an impact on the
> Angus> package.[Ch] code as we currently test for the presence of
> Angus> lyxrc.defaults.
> Sure, but we could test for any random file like configure.
Right. I'm just pointing out that there will be ripples if you throw a
stone into this pond.
--
Angus