From 734e22c4d38a42c9ae138934a192d1217e2cd634 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 22 Jul 2008 17:45:40 +0000 Subject: [PATCH] tentatively fix http://bugzilla.lyx.org/show_bug.cgi?id=4693 The problem stems I guess from the use of from_local8bit(). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25809 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/FileName.cpp | 6 ++++++ src/support/FileName.h | 2 ++ src/support/Package.cpp | 22 +++------------------- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index b11a7865c1..ecd703b043 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -426,6 +426,12 @@ FileName FileName::getcwd() } +FileName FileName::tempPath() +{ + return FileName(fromqstr(QDir::tempPath())); +} + + time_t FileName::lastModified() const { // QFileInfo caches information about the file. So, in case this file has diff --git a/src/support/FileName.h b/src/support/FileName.h index 516351e15a..bb635f3ce6 100644 --- a/src/support/FileName.h +++ b/src/support/FileName.h @@ -160,6 +160,8 @@ public: /// get the current working directory static FileName getcwd(); + static FileName tempPath(); + /// filename without path std::string onlyFileName() const; /// filename without path and without extension diff --git a/src/support/Package.cpp b/src/support/Package.cpp index c0a84e9a11..b6da91016f 100644 --- a/src/support/Package.cpp +++ b/src/support/Package.cpp @@ -95,8 +95,6 @@ FileName const get_locale_dir(FileName const & system_support_dir); FileName const get_system_support_dir(FileName const & abs_binary, string const & command_line_system_support_dir); -FileName const get_temp_dir(); - FileName const get_default_user_support_dir(FileName const & home_dir); bool userSupportDir(FileName const & default_user_support_dir, @@ -115,7 +113,9 @@ Package::Package(string const & command_line_arg0, : explicit_user_support_dir_(false) { home_dir_ = get_home_dir(); - system_temp_dir_ = get_temp_dir(); + // Specification of temp_dir_ may be reset by LyXRC, + // but the default is fixed for a given OS. + system_temp_dir_ = FileName::tempPath(); temp_dir_ = system_temp_dir_; document_dir_ = get_document_dir(home_dir_); @@ -367,22 +367,6 @@ FileName const get_locale_dir(FileName const & system_support_dir) } -// Specification of temp_dir_ may be reset by LyXRC, -// but the default is fixed for a given OS. -FileName const get_temp_dir() -{ -#if defined (USE_WINDOWS_PACKAGING) - // Typical example: C:/TEMP/. - char path[MAX_PATH]; - GetTempPath(MAX_PATH, path); - // Remove trailing backslash if any. - return FileName(rtrim(to_utf8(from_local8bit(path)), "\\")); -#else // Posix-like. - return FileName("/tmp"); -#endif -} - - // Extracts the absolute path from the foo of "-sysdir foo" or "-userdir foo" FileName const abs_path_from_command_line(string const & command_line) {