Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 2672 → Rev 2673

/branches/Version13x/Scribus/scribus/scpaths.cpp
1,9 → 1,18
#include "scpaths.h"
#include "qstring.h"
#include <qapplication.h>
 
#ifdef _MSC_VER
#if (_MSC_VER >= 1200)
#include "win-config.h"
#endif
#else
#include "config.h"
#endif
 
 
// On Qt/Mac we need CoreFoundation to discover the location
// of the app bundle.
#ifdef QT_MAC
#ifdef BUILD_MAC_BUNDLE
#include <CoreFoundation/CoreFoundation.h>
#endif
 
39,7 → 48,7
{
// On MacOS/X, override the compile-time settings with a location
// obtained from the system.
#if defined(QT_MAC) && defined(BUILD_MAC_BUNDLE)
#ifdef BUILD_MAC_BUNDLE
// Set up the various app paths to look inside the app bundle
CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());
CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef,
46,16 → 55,46
kCFURLPOSIXPathStyle);
const char *pathPtr = CFStringGetCStringPtr(macPath,
CFStringGetSystemEncoding());
m_docDir = strdup(QString("%1/Resources/docs/").arg(pathPtr));
m_iconDir = strdup(QString("%1/Resources/icons/").arg(pathPtr));
m_sampleDir = strdup(QString("%1/Resources/samples/").arg(pathPtr));
m_scriptDir = strdup(QString("%1/Resources/scripts/").arg(pathPtr));
m_templateDir = strdup(QString("%1/Resources/templates/").arg(pathPtr));
m_libDir = strdup(QString("%1/Resources/lib/").arg(pathPtr));
m_pluginDir = strdup(QString("%1/Resources/plugins/").arg(pathPtr));
char *p = pathPtr + strlen(pathPtr) -1;
while (*p == '/')
--p;
++p;
*p = '\0';
if (strcmp("/bin", p-4) == 0) {
p -= 4;
*p = '\0';
}
if (strcmp("/MacOS", p-6) == 0) {
p -= 6;
*p = '\0';
}
if (strcmp("/Contents", p-9) == 0) {
p -= 9;
*p = '\0';
}
// qDebug(QString("scpaths: bundle at %1:").arg(pathPtr));
m_docDir = strdup(QString("%1/Contents/share/scribus/doc/").arg(pathPtr));
m_iconDir = strdup(QString("%1/Contents/share/scribus/icons/").arg(pathPtr));
m_sampleScriptDir = strdup(QString("%1/Contents/share/scribus/samples/").arg(pathPtr));
m_scriptDir = strdup(QString("%1/Contents/share/scribus/scripts/").arg(pathPtr));
m_templateDir = strdup(QString("%1/Contents/share/scribus/templates/").arg(pathPtr));
m_libDir = strdup(QString("%1/Contents/lib/scribus/").arg(pathPtr));
m_pluginDir = strdup(QString("%1/Contents/lib/scribus/plugins/").arg(pathPtr));
QApplication::setLibraryPaths(QString("%1/Contents/lib/qtplugins/").arg(pathPtr));
CFRelease(pluginRef);
CFRelease(macPath);
#endif // defined(QT_MAC)
/*
qDebug(QString("scpaths: doc dir=%1").arg(m_docDir));
qDebug(QString("scpaths: icon dir=%1").arg(m_iconDir));
qDebug(QString("scpaths: sample dir=%1").arg(m_sampleScriptDir));
qDebug(QString("scpaths: script dir=%1").arg(m_scriptDir));
qDebug(QString("scpaths: template dir=%1").arg(m_templateDir));
qDebug(QString("scpaths: lib dir=%1").arg(m_libDir));
qDebug(QString("scpaths: plugin dir=%1").arg(m_pluginDir));
qDebug(QString("scpaths: qtplugins=%1").arg(QApplication::libraryPaths().join(":")));
*/
#endif // defined(BUILD_MAC_BUNDLE)
}
 
ScPaths::~ScPaths() {};