Uwe Stöhr wrote:
Maybe is works when this path is generated-with the quotes:
"C:\Documents and Settings\usti\Local
Settings\Temp\yx_tmpdir.Uhg712\lyx_tmpbuf0\0D__Download_01.jpg"
I could test it when you provide a patch.
Peter, do you work on Windows XP too? If yes, are you able to debug to
find the reason for the temp path problems?
Same problems here. Copying the pdf fails:
When exporting, copyFile() does nothing because
if (!prefixIs(onlyPath(sourceFile.absFilename()),
package().temp_dir().absFilename()))
(Exporter.cpp, 72)
fails due to different names of the same directory (prefixIs is string based):
C:/Dokumente und Einstellungen/cdev/Lokale Einstellungen/Temp/lyx_tmpbuf0/
C:/DOKUME~1/cdev/LOKALE~1/Temp
I assume this is the right direction a fix the bug.
It's maybe also a Qt bug?
Attached a patch which adds the conversion to long filenames from 8.3 names
(a function which a think should be part of Qt)
But with this patch applied LyX couldn't find the ui files any more?
Warning: Could not find UI definition file
Peter
Index: support/FileName.cpp
===================================================================
--- support/FileName.cpp (revision 26690)
+++ support/FileName.cpp (working copy)
@@ -180,9 +180,49 @@
}
+
+/* Qt code
+QString QFSFileEngine::tempPath()
+{
+ QString ret;
+ int success;
+ QT_WA({
+ wchar_t tempPath[MAX_PATH];
+ success = GetTempPathW(MAX_PATH, tempPath);
+ ret = QString::fromUtf16((ushort*)tempPath);
+ } , {
+ char tempPath[MAX_PATH];
+ success = GetTempPathA(MAX_PATH, tempPath);
+ ret = QString::fromLocal8Bit(tempPath);
+ });
+*/
+#ifdef Q_OS_WIN
+
+#include <windows.h>
+QString longPathName(const QString& path)
+{
+ if (path.isEmpty())
+ return QString();
+
+ QByteArray shortName = path.toLocal8Bit();;
+ char longPath[MAX_PATH];
+ int err = GetLongPathName(shortName.constData(), longPath, MAX_PATH);
+ (void)err;
+ return QString::fromLocal8Bit(longPath);
+}
+
+#else
+
+QString FileName::longPathName(const QString& path)
+{
+ return path;
+}
+
+#endif
+
string FileName::absFilename() const
{
- return fromqstr(d->fi.absoluteFilePath());
+ return fromqstr(longPathName(d->fi.absoluteFilePath()));
}
@@ -426,10 +466,11 @@
FileName FileName::tempPath()
{
- return FileName(fromqstr(QDir::tempPath()));
+ return FileName(fromqstr(longPathName(QDir::tempPath())));
}
+
time_t FileName::lastModified() const
{
// QFileInfo caches information about the file. So, in case this file
has