mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +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::quoteName;
|
||||||
using lyx::support::rtrim;
|
using lyx::support::rtrim;
|
||||||
using lyx::support::subst;
|
using lyx::support::subst;
|
||||||
|
using lyx::support::addName;
|
||||||
|
|
||||||
using std::endl;
|
using std::endl;
|
||||||
using std::find_if;
|
using std::find_if;
|
||||||
@ -917,15 +918,17 @@ bool LyXTextClass::load(string const & path) const
|
|||||||
if (loaded_)
|
if (loaded_)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Read style-file, current directory is searched before system ones
|
// Read style-file, provided path is searched before the system ones
|
||||||
string real_file = path + "/" + name_ + ".layout";
|
string layout_file;
|
||||||
if (!fs::exists(real_file))
|
if (!path.empty())
|
||||||
real_file = libFileSearch("layouts", name_, "layout");
|
layout_file = addName(path, name_ + ".layout");
|
||||||
loaded_ = const_cast<LyXTextClass*>(this)->read(real_file) == 0;
|
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_) {
|
if (!loaded_) {
|
||||||
lyxerr << "Error reading `"
|
lyxerr << "Error reading `"
|
||||||
<< makeDisplayPath(real_file)
|
<< makeDisplayPath(layout_file)
|
||||||
<< "'\n(Check `" << name_
|
<< "'\n(Check `" << name_
|
||||||
<< "')\nCheck your installation and "
|
<< "')\nCheck your installation and "
|
||||||
"try Options/Reconfigure..." << endl;
|
"try Options/Reconfigure..." << endl;
|
||||||
|
@ -84,7 +84,7 @@ public:
|
|||||||
LyXLayout_ptr const & operator[](std::string const & vname) const;
|
LyXLayout_ptr const & operator[](std::string const & vname) const;
|
||||||
|
|
||||||
/// Sees to that the textclass structure has been loaded
|
/// 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?
|
/// Has this layout file been loaded yet?
|
||||||
bool loaded() const { return loaded_; }
|
bool loaded() const { return loaded_; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user