X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyX.cpp;h=99ce873b61c0394db4ea9517df9b6eb55e655a3b;hb=f5a7aebdfa891baaae7c15affae3006b642ae90c;hp=b777e55f4e45c289029333d1c4499a5bd047cb59;hpb=805e51eff86a1c249d80728dcd3f8d70313bc35e;p=lyx.git diff --git a/src/LyX.cpp b/src/LyX.cpp index b777e55f4e..99ce873b61 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -563,8 +563,10 @@ void LyX::execCommands() // if some files were specified at command-line we assume that the // user wants to edit *these* files and not to restore the session. for (size_t i = 0; i != pimpl_->files_to_load_.size(); ++i) { + FileName const abs_path = + support::makeAbsPath(pimpl_->files_to_load_[i]); lyx::dispatch( - FuncRequest(LFUN_FILE_OPEN, pimpl_->files_to_load_[i])); + FuncRequest(LFUN_FILE_OPEN, abs_path.absoluteFilePath())); } // clear this list to save a few bytes of RAM pimpl_->files_to_load_.clear(); @@ -735,6 +737,18 @@ bool LyX::init() if (!setEnv("LyXDir", lyx_dir)) LYXERR(Debug::INIT, "\t... failed!"); + if (package().explicit_user_support() && getEnv(LYX_USERDIR_VER).empty()) { + // -userdir was given on the command line. + // Make it available to child processes, otherwise tex2lyx + // would not find all layout files, and other converters might + // use it as well. + string const user_dir = package().user_support().absFileName(); + LYXERR(Debug::INIT, "Setting " LYX_USERDIR_VER "... to \"" + << user_dir << '"'); + if (!setEnv(LYX_USERDIR_VER, user_dir)) + LYXERR(Debug::INIT, "\t... failed!"); + } + // // Read configuration files //