string binpath = os::binpath();
string binname = os::binname();
- string fullbinpath = binpath;
-
+ string fullbinname = MakeAbsPath(binname, binpath);
+
if (binpath.empty()) {
lyxerr << _("Warning: could not determine path of binary.")
<< "\n"
<< _("If you have problems, try starting LyX with an absolute path.")
<< endl;
}
+ lyxerr[Debug::INIT] << "Name of binary: " << binname << endl;
lyxerr[Debug::INIT] << "Path of binary: " << binpath << endl;
//
searchpath += lyxdir + ';';
}
- // <path of binary>/TOP_SRCDIR/lib
- build_lyxdir = MakeAbsPath("../lib", binpath);
- if (!FileSearch(build_lyxdir, "lyxrc.defaults").empty()) {
- searchpath += MakeAbsPath(AddPath(TOP_SRCDIR, "lib"),
- binpath) + ';';
- lyxerr[Debug::INIT] << "Checking whether LyX is run in "
- "place... yes" << endl;
- } else {
- lyxerr[Debug::INIT]
- << "Checking whether LyX is run in place... no"
- << endl;
- build_lyxdir.erase();
+ string fullbinpath = binpath;
+ FileInfo file(fullbinname, true);
+ if (file.isLink()) {
+ lyxerr[Debug::INIT] << "binary is a link" << endl;
+ string link;
+ if (LyXReadLink(fullbinname, link)) {
+ // Path of binary/../share/name of binary/
+ searchpath += NormalizePath(AddPath(binpath,
+ "../share/")
+ + OnlyFilename(binname));
+ searchpath += ';';
+ fullbinpath = link;
+ binpath = MakeAbsPath(OnlyPath(fullbinpath));
+ }
}
-
+
bool followlink;
do {
- // Path of binary/../share/name of binary/
+ // Path of binary/../share/name of binary/
searchpath += NormalizePath(AddPath(binpath, "../share/") +
OnlyFilename(binname)) + ';';
- // Follow Symlinks
+ // Follow Symlinks
FileInfo file(fullbinpath, true);
followlink = file.isLink();
if (followlink) {
+ lyxerr << " directory " << fullbinpath
+ << " is a link" << endl;
string link;
if (LyXReadLink(fullbinpath, link)) {
fullbinpath = link;
}
} while (followlink);
+ // <path of binary>/TOP_SRCDIR/lib
+ build_lyxdir = MakeAbsPath("../lib", binpath);
+ if (!FileSearch(build_lyxdir, "lyxrc.defaults").empty()) {
+ searchpath += MakeAbsPath(AddPath(TOP_SRCDIR, "lib"),
+ binpath) + ';';
+ lyxerr[Debug::INIT] << "Checking whether LyX is run in "
+ "place... yes" << endl;
+ } else {
+ lyxerr[Debug::INIT]
+ << "Checking whether LyX is run in place... no"
+ << endl;
+ build_lyxdir.erase();
+ }
+
// Hardcoded dir
searchpath += LYX_DIR;
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
string const lyxrc_path = LibFileSearch(string(), name);
- if (!lyxrc_path.empty()){
+ if (!lyxrc_path.empty()) {
lyxerr[Debug::INIT] << "Found " << name
<< " in " << lyxrc_path << endl;
if (lyxrc.read(lyxrc_path) < 0) {
break;
default:
- if(!strip(lex.getString()).empty())
+ if (!strip(lex.getString()).empty())
lex.printError("LyX::ReadUIFile: "
"Unknown menu tag: `$$Token'");
break;