#include "support/ExceptionMessage.h"
#include "support/filetools.h"
#include "support/gettext.h"
+#include "support/lassert.h"
#include "support/lstrings.h"
#include "support/os.h"
string const & command_line_user_support_dir,
exe_build_dir_to_top_build_dir top_build_dir_location)
{
- // Can do so only once.
- if (initialised_)
- return;
-
package_ = Package(command_line_arg0,
command_line_system_support_dir,
command_line_user_support_dir,
Package const & package()
{
- // Commented out because package().locale_dir() can be called
- // from the message translation code in Messages.cpp before
- // init_package() is called. Lars is on the case...
- // LASSERT(initialised_, /**/);
+ LASSERT(initialised_, /**/);
return package_;
}
FileName const abs_binary = abs_path_from_binary_name(command_line_arg0);
binary_dir_ = FileName(onlyPath(abs_binary.absFileName()));
+ // the LyX package directory
+ lyx_dir_ = FileName(addPath(binary_dir_.absFileName(), "../"));
+ lyx_dir_ = FileName(lyx_dir_.realPath());
+
// Is LyX being run in-place from the build tree?
buildDirs(abs_binary, top_build_dir_location,
build_support_dir_, system_support_dir_);
get_system_support_dir(abs_binary,
command_line_system_support_dir);
+ // The LyX executable is one level above binary_dir_ if we are running
+ // tex2lyx in place. Otherwise it is in binary_dir_.
+ string abs_lyx_dir;
+ if (build_support_dir_.empty() ||
+ top_build_dir_location == top_build_dir_is_one_level_up)
+ abs_lyx_dir = binary_dir_.absFileName();
+ else {
+ FileName fn(addPath(binary_dir_.absFileName(), "../"));
+ abs_lyx_dir = fn.realPath();
+ }
+ // The LyX executable may have a package suffix if we are not running
+ // in place.
+ if (build_support_dir_.empty())
+ lyx_binary_ = FileName(addName(abs_lyx_dir,
+ "lyx" + string(PROGRAM_SUFFIX)));
+ else
+ lyx_binary_ = FileName(addName(abs_lyx_dir, "lyx"));
+
locale_dir_ = get_locale_dir(system_support_dir_);
FileName const default_user_support_dir =
// 2. exe must be the name of the binary only and it
// can be found on the PATH.
- string const exe_name = onlyFilename(exe_path);
+ string const exe_name = onlyFileName(exe_path);
if (exe_name != exe_path)
return FileName();