mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
A small fix to the auto-cls-layout feature (r13611), by Bo Peng (ben.bob@gmail.com)
* src/lyxtextclass.[hC] improve load(path) function. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13795 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3c4e073313
commit
8e7bbcba29
@ -34,6 +34,7 @@ using lyx::support::makeDisplayPath;
|
||||
using lyx::support::quoteName;
|
||||
using lyx::support::rtrim;
|
||||
using lyx::support::subst;
|
||||
using lyx::support::addName;
|
||||
|
||||
using std::endl;
|
||||
using std::find_if;
|
||||
@ -917,15 +918,17 @@ bool LyXTextClass::load(string const & path) const
|
||||
if (loaded_)
|
||||
return true;
|
||||
|
||||
// Read style-file, current directory is searched before system ones
|
||||
string real_file = path + "/" + name_ + ".layout";
|
||||
if (!fs::exists(real_file))
|
||||
real_file = libFileSearch("layouts", name_, "layout");
|
||||
loaded_ = const_cast<LyXTextClass*>(this)->read(real_file) == 0;
|
||||
// Read style-file, provided path is searched before the system ones
|
||||
string layout_file;
|
||||
if (!path.empty())
|
||||
layout_file = addName(path, name_ + ".layout");
|
||||
if (layout_file.empty() || !fs::exists(layout_file))
|
||||
layout_file = libFileSearch("layouts", name_, "layout");
|
||||
loaded_ = const_cast<LyXTextClass*>(this)->read(layout_file) == 0;
|
||||
|
||||
if (!loaded_) {
|
||||
lyxerr << "Error reading `"
|
||||
<< makeDisplayPath(real_file)
|
||||
<< makeDisplayPath(layout_file)
|
||||
<< "'\n(Check `" << name_
|
||||
<< "')\nCheck your installation and "
|
||||
"try Options/Reconfigure..." << endl;
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
LyXLayout_ptr const & operator[](std::string const & vname) const;
|
||||
|
||||
/// Sees to that the textclass structure has been loaded
|
||||
bool load(std::string const & path=".") const;
|
||||
bool load(std::string const & path=std::string()) const;
|
||||
/// Has this layout file been loaded yet?
|
||||
bool loaded() const { return loaded_; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user