r19826 by craig - Make resource manager extract font files into a subdir named after the zip file if the font is delivered by zip to keep collections together

scribus-commit scribus-commit at lists.scribus.net
Tue Feb 17 18:55:16 UTC 2015


Author: craig
Date: Tue Feb 17 18:55:16 2015
New Revision: 19826

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19826
Log:
Make resource manager extract font files into a subdir named after the zip file if the font is delivered by zip to keep collections together

Modified:
    trunk/Scribus/scribus/ui/resourcemanager.cpp

Modified: trunk/Scribus/scribus/ui/resourcemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19826&path=/trunk/Scribus/scribus/ui/resourcemanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/resourcemanager.cpp (original)
+++ trunk/Scribus/scribus/ui/resourcemanager.cpp Tue Feb 17 18:55:16 2015
@@ -22,6 +22,8 @@
 #include <QComboBox>
 #include <QDebug>
 #include <QDomDocument>
+#include <QFile>
+#include <QFileInfo>
 #include <QString>
 #include <QStringList>
 #include <QTableWidget>
@@ -563,9 +565,10 @@
 				//qDebug()<<d.desc<<d.download<<d.files<<d.type;
 				if (d.filetype=="zip")
 				{
-					QString fn(ScPaths::getUserFontDir(false)+d.files);
+					QString fn(ScPaths::getUserFontDir(true)+d.files);
 					//qDebug()<<fn;
 					QFile dledFile(fn);
+					QFileInfo fi(dledFile);
 					if (!dledFile.exists())
 						qDebug()<<"File doesnt exist"<<fn;
 					else
@@ -576,10 +579,14 @@
 						else
 						{
 							QStringList toExtract(fun->files());
+							QString toDir(ScPaths::getUserFontDir(false)+fi.baseName()+"/");
+							QDir d(ScPaths::getUserFontDir(false));
+							if (!d.exists(fi.baseName()))
+								d.mkdir(fi.baseName());
 							foreach (QString f2e, toExtract)
 							{
-								//qDebug()<<"Unzipping"<<f2e;
-								fun->extract(f2e,ScPaths::getUserFontDir(false));
+								//qDebug()<<"Unzipping"<<f2e<<"to"<<toDir;
+								fun->extract(f2e,toDir);
 							}
 						}
 						delete fun;




More information about the scribus-commit mailing list