kdelibs kstandarddirs_win.cpp wrong and useless ?

Alexander Neundorf neundorf at kde.org
Sun Jan 4 16:02:29 CET 2009


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 ?

Alex


More information about the Kde-windows mailing list