From 430296f4afc6e1d6601088f1fe18b5b36e149d8b Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Mon, 9 Jun 2008 13:05:24 +0000 Subject: [PATCH] Hopefully fix http://bugzilla.lyx.org/show_bug.cgi?id=4918 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25207 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/LyX.cpp | 2 +- src/support/Package.cpp | 9 +++++++++ src/support/Package.h | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/LyX.cpp b/src/LyX.cpp index f2462aa44e..794df0da68 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -846,7 +846,7 @@ bool LyX::init() if (document_path.exists() && document_path.isDirectory()) package().document_dir() = document_path; - package().temp_dir() = createLyXTmpDir(FileName(lyxrc.tempdir_path)); + package().set_temp_dir(createLyXTmpDir(FileName(lyxrc.tempdir_path))); if (package().temp_dir().empty()) { Alert::error(_("Could not create temporary directory"), bformat(_("Could not create a temporary directory in\n" diff --git a/src/support/Package.cpp b/src/support/Package.cpp index 3d6c2971d0..80615ed5cd 100644 --- a/src/support/Package.cpp +++ b/src/support/Package.cpp @@ -162,6 +162,15 @@ Package::Package(string const & command_line_arg0, } +void Package::set_temp_dir(FileName const & temp_dir) const +{ + if (temp_dir.empty()) + temp_dir_ = system_temp_dir_; + else + temp_dir_ = temp_dir; +} + + namespace { // These next functions contain the stuff that is substituted at diff --git a/src/support/Package.h b/src/support/Package.h index bfd359faf1..f5440b924a 100644 --- a/src/support/Package.h +++ b/src/support/Package.h @@ -116,7 +116,10 @@ public: * (Eg /tmp/lyx_tmpdir800nBI1z9 on *nix.) * Can be reset by LyXRC. */ - FileName & temp_dir() const { return temp_dir_; } + //@{ + FileName const & temp_dir() const { return temp_dir_; } + void set_temp_dir(FileName const & temp_dir) const; + //@} /** Used when setting the user_support directory. * Used also when expanding "~/" or contracting to "~/". (filetools.cpp)