r18707 by craig - #11882: fix perms on profiles and fonts when collecting

scribus-commit scribus-commit at lists.scribus.net
Fri Jan 10 23:17:19 UTC 2014


Author: craig
Date: Fri Jan 10 23:17:18 2014
New Revision: 18707

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18707
Log:
#11882: fix perms on profiles and fonts when collecting

Modified:
    trunk/Scribus/scribus/collect4output.cpp

Modified: trunk/Scribus/scribus/collect4output.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18707&path=/trunk/Scribus/scribus/collect4output.cpp
==============================================================================
--- trunk/Scribus/scribus/collect4output.cpp (original)
+++ trunk/Scribus/scribus/collect4output.cpp Fri Jan 10 23:17:18 2014
@@ -357,7 +357,23 @@
 	for (it3 = m_Doc->UsedFonts.begin(); it3 != it3end; ++it3)
 	{
 		QFileInfo itf(prefsManager->appPrefs.fontPrefs.AvailFonts[it3.key()].fontFilePath());
-		copyFileAtomic(prefsManager->appPrefs.fontPrefs.AvailFonts[it3.key()].fontFilePath(), m_outputDirectory + "fonts/" + itf.fileName());
+		QString oldFileITF(prefsManager->appPrefs.fontPrefs.AvailFonts[it3.key()].fontFilePath());
+		QString outFileITF(m_outputDirectory + "fonts/" + itf.fileName());
+		bool success = copyFileAtomic(oldFileITF, outFileITF);
+		if (!success)
+			qDebug()<<"CollectForOutput::collectFile copyFileAtomic failed for"<<oldFileITF<<"to"<<outFileITF;
+		else
+		{
+			QFile of(outFileITF);
+			if (of.exists())
+			{
+				bool permsSet=of.setPermissions(QFile::permissions(oldFileITF));
+				if (!permsSet)
+					qDebug()<<"Unable to set permissions successfully while collecting for output on"<<outFileITF;
+			}
+			else
+				qDebug()<<"Unable to set permissions successfully while collecting for output on"<<outFileITF<<"as the file does not exist";
+		}
 		if (prefsManager->appPrefs.fontPrefs.AvailFonts[it3.key()].type() == ScFace::TYPE1)
 		{
 			QStringList metrics;
@@ -380,7 +396,22 @@
 			{
 				QString origAFM = metrics[a];
 				QFileInfo fi(origAFM);
-				copyFileAtomic(origAFM, m_outputDirectory + "fonts/" + fi.fileName());
+				QString outFileAFM(m_outputDirectory + "fonts/" + fi.fileName());
+				bool success = copyFileAtomic(origAFM, outFileAFM);
+				if (!success)
+					qDebug()<<"CollectForOutput::collectFile copyFileAtomic failed for"<<origAFM<<"to"<<outFileAFM;
+				else
+				{
+					QFile of(outFileAFM);
+					if (of.exists())
+					{
+						bool permsSet=of.setPermissions(QFile::permissions(origAFM));
+						if (!permsSet)
+							qDebug()<<"Unable to set permissions successfully while collecting for output on"<<outFileAFM;
+					}
+					else
+						qDebug()<<"Unable to set permissions successfully while collecting for output on"<<outFileAFM<<"as the file does not exist";
+				}
 			}
 		}
 		if (uiCollect)
@@ -438,8 +469,23 @@
 	for (ProfilesL::Iterator it = docProfiles.begin(); it != itend; ++it)
 	{
 		QString profileName(it.key());
-		QString profilePath(it.value());
-		copyFileAtomic(profilePath, m_outputDirectory + "profiles/" + QFileInfo(profilePath).fileName());
+		QString oldFile(it.value());
+		QString outFile(m_outputDirectory + "profiles/" + QFileInfo(oldFile).fileName());
+		bool success = copyFileAtomic(oldFile, outFile);
+		if (!success)
+			qDebug()<<"CollectForOutput::collectFile copyFileAtomic failed for"<<oldFile<<"to"<<outFile;
+		else
+		{
+			QFile of(outFile);
+			if (of.exists())
+			{
+				bool permsSet=of.setPermissions(QFile::permissions(oldFile));
+				if (!permsSet)
+					qDebug()<<"Unable to set permissions successfully while collecting for output on"<<outFile;
+			}
+			else
+				qDebug()<<"Unable to set permissions successfully while collecting for output on"<<outFile<<"as the file does not exist";
+		}
 		if (uiCollect)
 			emit profilesCollected(c++);
 	}




More information about the scribus-commit mailing list