]> git.lyx.org Git - lyx.git/blobdiff - src/LyX.cpp
Add comment.
[lyx.git] / src / LyX.cpp
index b777e55f4e45c289029333d1c4499a5bd047cb59..99ce873b61c0394db4ea9517df9b6eb55e655a3b 100644 (file)
@@ -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
        //