#include "frontends/alert.h"
#include "frontends/Application.h"
-#include "graphics/Previews.h"
-
#include "support/lassert.h"
#include "support/debug.h"
#include "support/environment.h"
/// the parsed command line batch command if any
vector<string> batch_commands;
- ///
- graphics::Previews preview_;
///
SpellChecker * spell_checker_;
///
{
// Minimal setting of locale before parsing command line
try {
- init_package(os::utf8_argv(0), string(), string(),
- top_build_dir_is_one_level_up);
+ init_package(os::utf8_argv(0), string(), string());
+ // we do not get to this point when init_package throws an exception
+ locale_init();
} catch (ExceptionMessage const & message) {
LYXERR(Debug::LOCALE, message.title_ + ", " + message.details_);
}
- // FIXME: This breaks out of source build under Windows.
- locale_init();
// Here we need to parse the command line. At least
// we need to parse for "-dbg" and "-help"
easyParse(argc, argv);
try {
- init_package(os::utf8_argv(0),
- cl_system_support, cl_user_support,
- top_build_dir_is_one_level_up);
+ init_package(os::utf8_argv(0), cl_system_support, cl_user_support);
} catch (ExceptionMessage const & message) {
if (message.type_ == ErrorException) {
Alert::error(message.title_, message.details_);
"hope you have not lost any data.\n"
"Please read the bug-reporting instructions "
"in 'Help->Introduction' and send us a bug report, "
- "if necessary. Thanks !\nBye.");
+ "if necessary. Thanks!\nBye.");
break;
case SIGINT:
case SIGTERM:
"templates");
}
+ // init LyXDir environment variable
+ string const lyx_dir = package().lyx_dir().absFileName();
+ LYXERR(Debug::INIT, "Setting LyXDir... to \"" << lyx_dir << "\"");
+ if (!setEnv("LyXDir", lyx_dir))
+ LYXERR(Debug::INIT, "\t... failed!");
+
//
// Read configuration files
//
prependEnvPath("PATH", package().binary_dir().absFileName());
#endif
if (!lyxrc.path_prefix.empty())
- prependEnvPath("PATH", lyxrc.path_prefix);
+ prependEnvPath("PATH", replaceEnvironmentPath(lyxrc.path_prefix));
// Check that user LyX directory is ok.
if (queryUserLyXDir(package().explicit_user_support()))
system_lcolor = lcolor;
// This one is edited through the preferences dialog.
- if (!readRcFile("preferences"))
+ if (!readRcFile("preferences", true))
return false;
if (!readEncodingsFile("encodings", "unicodesymbols"))
os::windows_style_tex_paths(lyxrc.windows_style_tex_paths);
if (!lyxrc.path_prefix.empty())
- prependEnvPath("PATH", lyxrc.path_prefix);
+ prependEnvPath("PATH", replaceEnvironmentPath(lyxrc.path_prefix));
FileName const document_path(lyxrc.document_path);
if (document_path.exists() && document_path.isDirectory())
}
-bool LyX::readRcFile(string const & name)
+bool LyX::readRcFile(string const & name, bool check_format)
{
LYXERR(Debug::INIT, "About to read " << name << "... ");
FileName const lyxrc_path = libFileSearch(string(), name);
- if (!lyxrc_path.empty()) {
- LYXERR(Debug::INIT, "Found in " << lyxrc_path);
- if (!lyxrc.read(lyxrc_path)) {
- showFileError(name);
- return false;
- }
- } else {
+ if (lyxrc_path.empty()) {
LYXERR(Debug::INIT, "Not found." << lyxrc_path);
+ // FIXME
+ // This was the previous logic, but can it be right??
+ return true;
}
- return true;
+ LYXERR(Debug::INIT, "Found in " << lyxrc_path);
+ bool const success = lyxrc.read(lyxrc_path, check_format);
+ if (!success)
+ showFileError(name);
+ return success;
}
// Read the languages file `name'
}
-graphics::Previews & thePreviews()
-{
- LASSERT(singleton_, /**/);
- return singleton_->pimpl_->preview_;
-}
-
-
Session & theSession()
{
LASSERT(singleton_, /**/);