bool followlink;
do {
// Path of binary/../share/name of binary/
- searchpath += NormalizePath(AddPath(binpath, "../share/") +
- OnlyFilename(binname)) + ';';
+ string const exe_name = OnlyFilename(binname);
+#ifdef _WIN32
+ string const lyx_system_dir_name =
+ suffixIs(exe_name, ".exe") ?
+ ChangeExtension(exe_name, "") :
+ exe_name;
+#else
+ string const lyx_system_dir_name = exe_name;
+#endif
+ string const shared_dir_name =
+ NormalizePath(AddPath(binpath, "../share/"));
+ searchpath += shared_dir_name + lyx_system_dir_name + ';';
// Follow Symlinks
FileInfo file(fullbinpath, true);
// This is true when we are running from a Mac OS X bundle
// (for LyX/Mac)
- bool const inOSXBundle =
+ bool const inOSXBundle =
system_lyxdir_ == NormalizePath(AddPath(binpath, "../Resources/")
+ OnlyFilename(binname));
if (inOSXBundle)
+ ":/sw/bin:/usr/local/bin"
+ ":/usr/local/teTeX/bin/powerpc-apple-darwin-current";
lyx::support::putenv("PATH", newpath);
- lyxerr[Debug::INIT] << "LyX/Mac: setting PATH to: "
+ lyxerr[Debug::INIT] << "LyX/Mac: setting PATH to: "
<< GetEnv("PATH") << endl;
}
- //
+ //
// Determine locale directory
//
if (!GetEnv("LYX_LOCALEDIR").empty()) {
localedir_ = GetEnv("LYX_LOCALEDIR");
lyxerr[Debug::INIT] << "LYX_LOCALEDIR=" << localedir_ << endl;
} else if (inOSXBundle) {
- string const maybe_localedir =
- NormalizePath(AddPath(system_lyxdir_, "../locale"));
+ string const maybe_localedir =
+ NormalizePath(AddPath(system_lyxdir_, "../locale"));
FileInfo fi(maybe_localedir);
if (fi.isOK() && fi.isDir()) {
- lyxerr[Debug::INIT]
+ lyxerr[Debug::INIT]
<< "LyX/Mac: setting locale directory to "
<< maybe_localedir << endl;
localedir_ = maybe_localedir;
// default behaviour
if (user_lyxdir_.empty())
if (inOSXBundle)
- user_lyxdir_ = AddPath(GetEnvPath("HOME"),
+ user_lyxdir_ = AddPath(os::homepath(),
"Library/Preferences/LyX");
else
- user_lyxdir_ = AddPath(GetEnvPath("HOME"),
+ user_lyxdir_ = AddPath(os::homepath(),
string(".") + PACKAGE);
explicit_userdir = false;
}