From d7fae16a3b5e8ff7540295d515537f7d955fb975 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 23 Jul 2008 08:28:51 +0000 Subject: [PATCH] Safer temp file creation with regards to double slash. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25828 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/FileName.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index 2ac9262c2f..70c7b8ba87 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -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; } -- 2.39.2