mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-07 12:32:26 +00:00
Don't use a global variable for avoiding removal of the system temp dir
* src/support/package.h (Package::system_temp_dir): new, return the system temp dir. * src/support/package.C.in (Package::Package): record the system temp dir. * src/lyx_main.C (LyX::prepareExit): don't remove the temporary directory if it is the same as the system temp dir, meaning that the lyx_tmpdir has not yet been created. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16318 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e3241cca0a
commit
6b5289825e
@ -110,9 +110,6 @@ bool use_gui = true;
|
||||
|
||||
namespace {
|
||||
|
||||
/// Don't try to remove the temporary directory if it has not been created
|
||||
bool remove_tmpdir = false;
|
||||
|
||||
// Filled with the command line arguments "foo" of "-sysdir foo" or
|
||||
// "-userdir foo".
|
||||
string cl_system_support;
|
||||
@ -422,7 +419,7 @@ void LyX::prepareExit()
|
||||
pimpl_->buffer_list_.closeAll();
|
||||
|
||||
// do any other cleanup procedures now
|
||||
if (remove_tmpdir) {
|
||||
if (package().temp_dir() != package().system_temp_dir()) {
|
||||
lyxerr[Debug::INFO] << "Deleting tmp dir "
|
||||
<< package().temp_dir() << endl;
|
||||
|
||||
@ -856,7 +853,6 @@ bool LyX::init()
|
||||
// trying again but simply exit.
|
||||
return false;
|
||||
}
|
||||
remove_tmpdir = true;
|
||||
|
||||
if (lyxerr.debugging(Debug::INIT)) {
|
||||
lyxerr << "LyX tmp dir: `" << package().temp_dir() << '\'' << endl;
|
||||
|
@ -124,7 +124,8 @@ Package::Package(string const & command_line_arg0,
|
||||
: explicit_user_support_dir_(false)
|
||||
{
|
||||
home_dir_ = get_home_dir();
|
||||
temp_dir_ = get_temp_dir();
|
||||
system_temp_dir_ = get_temp_dir();
|
||||
temp_dir_ = system_temp_dir_;
|
||||
document_dir_ = get_document_dir(home_dir_);
|
||||
|
||||
string const abs_binary = abs_path_from_binary_name(command_line_arg0);
|
||||
|
@ -104,8 +104,13 @@ public:
|
||||
*/
|
||||
std::string & document_dir() const;
|
||||
|
||||
/** The path to the temporary directory.
|
||||
/** The path to the system temporary directory.
|
||||
* (Eg /tmp on *nix.)
|
||||
*/
|
||||
std::string const & system_temp_dir() const;
|
||||
|
||||
/** The path to the temporary directory used by LyX.
|
||||
* (Eg /tmp/lyx_tmpdir800nBI1z9 on *nix.)
|
||||
* Can be reset by LyXRC.
|
||||
*/
|
||||
std::string & temp_dir() const;
|
||||
@ -129,6 +134,7 @@ private:
|
||||
std::string locale_dir_;
|
||||
mutable std::string document_dir_;
|
||||
mutable std::string temp_dir_;
|
||||
std::string system_temp_dir_;
|
||||
std::string home_dir_;
|
||||
std::string configure_command_;
|
||||
bool explicit_user_support_dir_;
|
||||
@ -186,6 +192,12 @@ std::string & Package::temp_dir() const
|
||||
return temp_dir_;
|
||||
}
|
||||
|
||||
inline
|
||||
std::string const & Package::system_temp_dir() const
|
||||
{
|
||||
return system_temp_dir_;
|
||||
}
|
||||
|
||||
inline
|
||||
std::string const & Package::home_dir() const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user