From e3a494d322f1f33ab805a8e51a851c5adf0f45a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20K=C3=BCmmel?= Date: Sat, 4 Oct 2008 12:05:06 +0000 Subject: [PATCH] fix bug 4693, Exporting files doesn't create the files in the correct folder git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26718 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/FileName.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index 48a2e3c67f..5c95553a99 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -121,6 +121,23 @@ struct FileName::Private #endif } + static QString longPathName(QString const & path) + { +#ifndef Q_OS_WIN + return path; +#else + if (path.isEmpty()) { + return QString(); + } + QString maybeShort = QDir::toNativeSeparators(path); + QByteArray shortName = maybeShort.toLocal8Bit();; + char longPath[MAX_PATH]; + int err = GetLongPathName(shortName.constData(), longPath, MAX_PATH); + (void)err; + return QDir::fromNativeSeparators(QString::fromLocal8Bit(longPath)); +#endif + } + /// QFileInfo fi; }; @@ -426,7 +443,7 @@ FileName FileName::getcwd() FileName FileName::tempPath() { - return FileName(fromqstr(QDir::tempPath())); + return FileName(fromqstr(Private::longPathName(QDir::tempPath()))); } -- 2.39.2