author | zecke <zecke> | 2004-10-15 21:04:08 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-15 21:04:08 (UTC) |
commit | 0bdebb46227ea403a07707cf0a967c8ea036e03f (patch) (side-by-side diff) | |
tree | d6e724a055475f3938ee5a8955692209d490ba37 | |
parent | ac36bfe2794741188da1d6d4b471f96fd15d47ee (diff) | |
download | opie-0bdebb46227ea403a07707cf0a967c8ea036e03f.zip opie-0bdebb46227ea403a07707cf0a967c8ea036e03f.tar.gz opie-0bdebb46227ea403a07707cf0a967c8ea036e03f.tar.bz2 |
Make sure that qpeDir() has a QDir::seperator() as last character. This code
comes from Qtopia1.7
Conversion to it is done by myself
-rw-r--r-- | library/qpeapplication.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 3efba20..0b6d56d 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -386,13 +386,13 @@ public: show_mx(mw, nomax, appName); } } void loadTextCodecs() { - QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; + QString path = QPEApplication::qpeDir() + "plugins/textcodecs"; #ifdef Q_OS_MACX QDir dir( path, "lib*.dylib" ); #else QDir dir( path, "lib*.so" ); #endif QStringList list; @@ -415,13 +415,13 @@ public: } } } void loadImageCodecs() { - QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; + QString path = QPEApplication::qpeDir() + "plugins/imagecodecs"; #ifdef Q_OS_MACX QDir dir( path, "lib*.dylib" ); #else QDir dir( path, "lib*.so" ); #endif QStringList list; @@ -1184,17 +1184,30 @@ QPEApplication::~QPEApplication() /*! Returns <tt>$OPIEDIR/</tt>. */ QString QPEApplication::qpeDir() { - const char * base = getenv( "OPIEDIR" ); - if ( base ) - return QString( base ) + "/"; + QString base, dir; + + if (getenv( "OPIEDIR" )) + base = QString(getenv("OPIEDIR")).stripWhiteSpace(); + if ( !base.isNull() && (base.length() > 0 )){ +#ifdef Q_OS_WIN32 + QString temp(base); + if (temp[(int)temp.length()-1] != QDir::separator()) + temp.append(QDir::separator()); + dir = temp; +#else + dir = QString( base ) + "/"; +#endif + }else{ + dir = QString( ".." ) + QDir::separator(); + } - return QString( "../" ); + return dir; } /*! Returns the user's current Document directory. There is a trailing "/". .. well, it does now,, and there's no trailing '/' */ @@ -1832,13 +1845,13 @@ void QPEApplication::internalSetStyle( const QString &style ) setStyle( new QMotifPlusStyle ); } #endif else { QStyle *sty = 0; - QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; + QString path = QPEApplication::qpeDir ( ) + "plugins/styles/"; #ifdef Q_OS_MACX if ( style. find ( ".dylib" ) > 0 ) path += style; else path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility |