mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-08 20:32:49 +00:00
use plain C++ instead of boost
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21788 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
23c291bb6c
commit
134a72d555
@ -26,26 +26,15 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
|
#include <boost/filesystem/config.hpp>
|
||||||
|
#include <boost/detail/workaround.hpp>
|
||||||
|
#include <boost/throw_exception.hpp>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
||||||
using std::map;
|
|
||||||
using std::string;
|
|
||||||
using std::ifstream;
|
|
||||||
using std::ostringstream;
|
|
||||||
using std::endl;
|
|
||||||
|
|
||||||
|
|
||||||
// FIXME: merge this
|
|
||||||
//
|
|
||||||
#include <boost/filesystem/config.hpp>
|
|
||||||
#include <boost/detail/workaround.hpp>
|
|
||||||
#include <boost/throw_exception.hpp>
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
@ -56,6 +45,15 @@ using std::endl;
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
|
||||||
|
using std::map;
|
||||||
|
using std::string;
|
||||||
|
using std::ifstream;
|
||||||
|
using std::ostringstream;
|
||||||
|
using std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
// FIXME: merge this
|
||||||
|
//
|
||||||
// BOOST_POSIX or BOOST_WINDOWS specify which API to use.
|
// BOOST_POSIX or BOOST_WINDOWS specify which API to use.
|
||||||
# if !defined( BOOST_WINDOWS ) && !defined( BOOST_POSIX )
|
# if !defined( BOOST_WINDOWS ) && !defined( BOOST_POSIX )
|
||||||
# if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)
|
# if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__)
|
||||||
|
@ -26,10 +26,8 @@
|
|||||||
# include "support/os_win32.h"
|
# include "support/os_win32.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/tuple/tuple.hpp>
|
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#if !defined (USE_WINDOWS_PACKAGING) && \
|
#if !defined (USE_WINDOWS_PACKAGING) && \
|
||||||
!defined (USE_MACOSX_PACKAGING) && \
|
!defined (USE_MACOSX_PACKAGING) && \
|
||||||
@ -85,9 +83,9 @@ namespace {
|
|||||||
|
|
||||||
FileName const abs_path_from_binary_name(string const & exe);
|
FileName const abs_path_from_binary_name(string const & exe);
|
||||||
|
|
||||||
std::pair<FileName, FileName> const
|
void buildDirs(FileName const & abs_binary,
|
||||||
get_build_dirs(FileName const & abs_binary,
|
exe_build_dir_to_top_build_dir top_build_dir_location,
|
||||||
exe_build_dir_to_top_build_dir top_build_dir_location);
|
FileName &, FileName &);
|
||||||
|
|
||||||
FileName const get_document_dir(FileName const & home_dir);
|
FileName const get_document_dir(FileName const & home_dir);
|
||||||
|
|
||||||
@ -102,9 +100,8 @@ FileName const get_temp_dir();
|
|||||||
|
|
||||||
FileName const get_default_user_support_dir(FileName const & home_dir);
|
FileName const get_default_user_support_dir(FileName const & home_dir);
|
||||||
|
|
||||||
std::pair<FileName, bool> const
|
bool userSupportDir(FileName const & default_user_support_dir,
|
||||||
get_user_support_dir(FileName const & default_user_support_dir,
|
string const & command_line_user_support_dir, FileName & result);
|
||||||
string const & command_line_user_support_dir);
|
|
||||||
|
|
||||||
|
|
||||||
string const & with_version_suffix();
|
string const & with_version_suffix();
|
||||||
@ -132,8 +129,8 @@ Package::Package(string const & command_line_arg0,
|
|||||||
binary_dir_ = FileName(bdir);
|
binary_dir_ = FileName(bdir);
|
||||||
|
|
||||||
// Is LyX being run in-place from the build tree?
|
// Is LyX being run in-place from the build tree?
|
||||||
boost::tie(build_support_dir_, system_support_dir_) =
|
buildDirs(abs_binary, top_build_dir_location,
|
||||||
get_build_dirs(abs_binary, top_build_dir_location);
|
build_support_dir_, system_support_dir_);
|
||||||
|
|
||||||
if (build_support_dir_.empty())
|
if (build_support_dir_.empty())
|
||||||
system_support_dir_ =
|
system_support_dir_ =
|
||||||
@ -144,9 +141,9 @@ Package::Package(string const & command_line_arg0,
|
|||||||
|
|
||||||
FileName const default_user_support_dir =
|
FileName const default_user_support_dir =
|
||||||
get_default_user_support_dir(home_dir_);
|
get_default_user_support_dir(home_dir_);
|
||||||
boost::tie(user_support_dir_, explicit_user_support_dir_) =
|
FileName user_support_dir_;
|
||||||
get_user_support_dir(default_user_support_dir,
|
explicit_user_support_dir_ = userSupportDir(default_user_support_dir,
|
||||||
command_line_user_support_dir);
|
command_line_user_support_dir, user_support_dir_);
|
||||||
|
|
||||||
FileName const configure_script(addName(system_support().absFilename(), "configure.py"));
|
FileName const configure_script(addName(system_support().absFilename(), "configure.py"));
|
||||||
configure_command_ = os::python() + ' ' +
|
configure_command_ = os::python() + ' ' +
|
||||||
@ -238,8 +235,7 @@ string const fix_dir_name(string const & name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FileName const
|
FileName buildSupportDir(string const & binary_dir,
|
||||||
get_build_support_dir(string const & binary_dir,
|
|
||||||
exe_build_dir_to_top_build_dir top_build_dir_location)
|
exe_build_dir_to_top_build_dir top_build_dir_location)
|
||||||
{
|
{
|
||||||
string indirection;
|
string indirection;
|
||||||
@ -255,9 +251,9 @@ get_build_support_dir(string const & binary_dir,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::pair<FileName, FileName> const
|
void buildDirs(FileName const & abs_binary,
|
||||||
get_build_dirs(FileName const & abs_binary,
|
exe_build_dir_to_top_build_dir top_build_dir_location,
|
||||||
exe_build_dir_to_top_build_dir top_build_dir_location)
|
FileName & build_support_dir, FileName & system_support_dir)
|
||||||
{
|
{
|
||||||
string const check_text = "Checking whether LyX is run in place...";
|
string const check_text = "Checking whether LyX is run in place...";
|
||||||
|
|
||||||
@ -276,17 +272,16 @@ get_build_dirs(FileName const & abs_binary,
|
|||||||
// We may be using libtools with static linking.
|
// We may be using libtools with static linking.
|
||||||
if (suffixIs(binary_dir, ".libs/"))
|
if (suffixIs(binary_dir, ".libs/"))
|
||||||
binary_dir = addPath(binary_dir, "../");
|
binary_dir = addPath(binary_dir, "../");
|
||||||
FileName const build_support_dir =
|
build_support_dir = buildSupportDir(binary_dir, top_build_dir_location);
|
||||||
get_build_support_dir(binary_dir, top_build_dir_location);
|
|
||||||
if (!fileSearch(build_support_dir.absFilename(), "Makefile").empty()) {
|
if (!fileSearch(build_support_dir.absFilename(), "Makefile").empty()) {
|
||||||
// Try and find "chkconfig.ltx".
|
// Try and find "chkconfig.ltx".
|
||||||
string const system_support_dir =
|
system_support_dir =
|
||||||
addPath(Package::top_srcdir().absFilename(), "lib");
|
FileName(addPath(Package::top_srcdir().absFilename(), "lib"));
|
||||||
|
|
||||||
if (!fileSearch(system_support_dir, "chkconfig.ltx").empty()) {
|
if (!fileSearch(system_support_dir.absFilename(), "chkconfig.ltx").empty()) {
|
||||||
lyxerr[Debug::INIT] << check_text << " yes"
|
lyxerr[Debug::INIT] << check_text << " yes"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return std::make_pair(build_support_dir, system_support_dir);
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +300,8 @@ get_build_dirs(FileName const & abs_binary,
|
|||||||
}
|
}
|
||||||
|
|
||||||
lyxerr[Debug::INIT] << check_text << " no" << std::endl;
|
lyxerr[Debug::INIT] << check_text << " no" << std::endl;
|
||||||
return std::make_pair(FileName(), FileName());
|
system_support_dir = FileName();
|
||||||
|
build_support_dir = FileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -581,26 +577,22 @@ get_system_support_dir(FileName const & abs_binary,
|
|||||||
// Returns the absolute path to the user lyxdir, together with a flag
|
// Returns the absolute path to the user lyxdir, together with a flag
|
||||||
// indicating whether this directory was specified explicitly (as -userdir
|
// indicating whether this directory was specified explicitly (as -userdir
|
||||||
// or through an environment variable) or whether it was deduced.
|
// or through an environment variable) or whether it was deduced.
|
||||||
std::pair<FileName, bool> const
|
bool userSupportDir(FileName const & default_user_support_dir,
|
||||||
get_user_support_dir(FileName const & default_user_support_dir,
|
string const & command_line_user_support_dir, FileName & result)
|
||||||
string const & command_line_user_support_dir)
|
|
||||||
{
|
{
|
||||||
bool explicit_userdir = true;
|
|
||||||
|
|
||||||
// 1. Use the -userdir command line parameter.
|
// 1. Use the -userdir command line parameter.
|
||||||
FileName path =
|
result = abs_path_from_command_line(command_line_user_support_dir);
|
||||||
abs_path_from_command_line(command_line_user_support_dir);
|
if (!result.empty())
|
||||||
if (!path.empty())
|
return true;
|
||||||
return std::make_pair(path, explicit_userdir);
|
|
||||||
|
|
||||||
// 2. Use the LYX_USERDIR_15x environment variable.
|
// 2. Use the LYX_USERDIR_15x environment variable.
|
||||||
path = extract_env_var_dir("LYX_USERDIR_15x");
|
result = extract_env_var_dir("LYX_USERDIR_15x");
|
||||||
if (!path.empty())
|
if (!result.empty())
|
||||||
return std::make_pair(path, explicit_userdir);
|
return true;
|
||||||
|
|
||||||
// 3. Use the OS-dependent default_user_support_dir
|
// 3. Use the OS-dependent default_user_support_dir
|
||||||
explicit_userdir = false;
|
result = default_user_support_dir;
|
||||||
return std::make_pair(default_user_support_dir, explicit_userdir);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user