Jean-Marc Lasgouttes wrote: > Angus> On *nix we specify "HOME" with homepath_ = GetEnvPath("HOME"); > > Angus> On Windows, where $HOME doesn't exist, we currently use: > Angus> homepath_ = GetEnvPath("HOMEDRIVE") + GetEnvPath("HOMEPATH"); > > Angus> Trouble is, this doesn't seem very robust. The lyx_init.txt > Angus> output that I posted earlier this morning indicates that > > Angus> HOMEDRIVE=C: HOMEPATH=\ LOGNAME=Angus USERNAME=Angus > Angus> USERPROFILE=C:\Documents and Settings\Angus > > Angus> The question is, where would an intelligent default location > Angus> for the user .lyx dir be? I'd suggest that it should be > Angus> C:\Documents and Settings\Angus\.lyx > > Angus> That would suggest code: homepath_ = GetEnvPath("USERPROFILE"); > > I think HOME is used for two unrelated things: > > 1/ the user_lyxdir. For windows, this should be something like > $USERPROFILE/LyX, I think (LyX/Mac already has special code to set > user_lyxdir, that should probably be generalized and cleaned up). > > 2/ the documents home. In windows this should be the 'My Documents' > folder. > > So it is not as simple as replacing HOME with something else.
Hmmm. Isn't the encapsulation already there? In lyx 14x we have support/path_defines.[Ch]: std::string const & system_lyxdir(); std::string const & user_lyxdir(); lyxrc.[Ch]: // The default path for your documents. // An empty value selects the directory LyX was started from. std::string document_path; In 13x, the same variables are present although they are found in diferent locations. However, os::homepath() is used in lots of places, eg to initialise the above when all else fails. What you're saying is that 'document_path' on Windows should be initialised to '$USERPROFILE/My documents' rather than to '$USERPROFILE' on Windows boxes. Assuming that that 'My documents' directory exists of course. I'll try and have a go. Incidentally, I see that you're commenting on these hypothetical questions, but not on the concrete 'Are you happy to see this patch committed to the 13x tree' that I ask in [PATCH 13x, 14x] starting LyX successfully under Windows. -- Angus