]> git.lyx.org Git - features.git/commitdiff
tentatively fix http://bugzilla.lyx.org/show_bug.cgi?id=4693
authorAbdelrazak Younes <younes@lyx.org>
Tue, 22 Jul 2008 17:45:40 +0000 (17:45 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Tue, 22 Jul 2008 17:45:40 +0000 (17:45 +0000)
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
src/support/FileName.h
src/support/Package.cpp

index b11a7865c1e13f9d33d391403cab5dc9a2ddc753..ecd703b0436087313afda54f29e3685cca51ef54 100644 (file)
@@ -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
index 516351e15a3117cbc6ad5d1ad0bb89a8ced0623f..bb635f3ce6cd2fa5bb8aa70031976348395e6973 100644 (file)
@@ -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
index c0a84e9a1150d05fc31f07d7db1dd21155fb1d34..b6da91016fe0df12543eee73674566fbc709c9e8 100644 (file)
@@ -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)
 {