Alexander Neundorf schrieb:
On Sunday 04 January 2009, you wrote:
Alexander Neundorf schrieb:
Hi,

I just had a look at kdelibs/kdecore/kernel/kstandarddirs_win.cpp, it
contains only one function, which is
QString KStandardDirs::installPath(const char *type);

This is what you see if you execute "kde4-config --install lib" or
something else instead "lib".

Why are the directories hardcoded ? Isn't this wrong if they are set to
something else ? I think kstandarddirs_unix.cpp should be just fine also
for Windows.

Can somebody please check ?
What do you think is hardcoded there?

Not the install prefix, but the subdir:

        case 'e':
            if (strcmp("exe", type) == 0)
                return prefix() + QLatin1String("bin/");
            break;

instead of using BIN_INSTALL_DIR from config.h. Could be instead:

// small helper function
QString makeAbsolute(const QString& dir)
{
   QString tmp = dir;
   if (!QDir::isAbsolute(tmp))
   {
#if WINDOWS
   tmp = getKde4Prefix() + tmp;
#else
   tmp = QString::fromLatin1(KDEDIR "/") + tmp;
#endif
   }
   return tmp;
}

...
     case 'e':
         if (strcmp("exe", type) == 0)
             return makeAbsolute(QString::fromLatin1(BIN_INSTALL_DIR "/");
         break;


What do you think ?

If you want feel free to merge. Looks like the seeparation was done once we had absolute paths on windows too. But I wouldn't use QDir::isAbsolute(). On windows it's never absolute and on linux it should be faster to check for '/' only.
-->
inline QString makeAbsolute(const QString& dir)
{
#ifdef Q_WS_WIN
  return getKde4Prefix() + tmp;
#else
  if(dir.startsWith('/'))
    return dir;
  return KDEDIR + QLatin1Char('/') + dir;
#endif
}

Christian

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Kde-windows mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-windows

Reply via email to