r18057 by jghali - #11279 (partial fix): Image links get corrupted when symlinks involved
scribus-commit
scribus-commit at lists.scribus.net
Sun Jan 6 15:11:14 UTC 2013
Author: jghali
Date: Sun Jan 6 15:11:14 2013
New Revision: 18057
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18057
Log:
#11279 (partial fix): Image links get corrupted when symlinks involved
Modified:
branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
Modified: branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18057&path=/branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp (original)
+++ branches/Version14x/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp Sun Jan 6 15:11:14 2013
@@ -37,8 +37,15 @@
bool Scribus134Format::saveFile(const QString & fileName, const FileFormat & /* fmt */)
{
QString text, tf, tf2, tc, tc2;
+ m_lastSavedFile = "";
+
+ // #11279: Image links get corrupted when symlinks involved
+ // We have to proceed in tow steps here as QFileInfo::canonicalPath()
+ // may no return correct result if fileName does not exists
QString fileDir = QFileInfo(fileName).absolutePath();
- m_lastSavedFile = "";
+ QString canonicalPath = QFileInfo(fileDir).canonicalFilePath();
+ if (!canonicalPath.isEmpty())
+ fileDir = canonicalPath;
// Create a random temporary file name
srand(time(NULL)); // initialize random sequence each time
@@ -52,13 +59,6 @@
}
if (QFile::exists(tmpFileName))
return false;
-
- /*QDomDocument docu("scribus");
- QString st="<SCRIBUSUTF8NEW></SCRIBUSUTF8NEW>";
- docu.setContent(st);
- QDomElement elem=docu.documentElement();
- elem.setAttribute("Version", QString(VERSION));
- QDomElement dc=docu.createElement("DOCUMENT");*/
std::auto_ptr<QIODevice> outputFile;
if (fileName.toLower().right(2) == "gz")
More information about the scribus-commit
mailing list