]> git.lyx.org Git - features.git/commitdiff
Safer temp file creation with regards to double slash.
authorAbdelrazak Younes <younes@lyx.org>
Wed, 23 Jul 2008 08:28:51 +0000 (08:28 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 23 Jul 2008 08:28:51 +0000 (08:28 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25828 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/FileName.cpp

index 2ac9262c2f90827e783804002e327c4a62d10176..70c7b8ba87b670bfecec9cd0e81310dd010404b1 100644 (file)
@@ -355,16 +355,13 @@ FileNameList FileName::dirList(string const & ext) const
 
 FileName FileName::tempName(string const & mask)
 {
-       FileName tmp_name(mask);
-       string tmpfl;
-       if (tmp_name.d->fi.isAbsolute())
-               tmpfl = mask;
-       else
-               tmpfl = package().temp_dir().absFilename() + "/" + mask;
+       QFileInfo tmp_fi(toqstr(mask));
+       if (!tmp_fi.isAbsolute())
+               tmp_fi.setFile(package().temp_dir().d->fi.absoluteDir(), toqstr(mask));
 
-       QTemporaryFile qt_tmp(toqstr(tmpfl));
+       QTemporaryFile qt_tmp(tmp_fi.absoluteFilePath());
        if (qt_tmp.open()) {
-               tmp_name.d->fi.setFile(qt_tmp.fileName());
+               FileName tmp_name(fromqstr(qt_tmp.fileName()));
                LYXERR(Debug::FILES, "Temporary file `" << tmp_name << "' created.");
                return tmp_name;
        }