[patch] use '; ' as $PATH separator + add KDIR_SEPARATOR optimization

Andreas Pakulat apaku at gmx.de
Fri Jan 18 19:20:31 GMT 2008


On 18.01.08 19:57:41, Jarosław Staniek wrote:
>
> Hello
> Please review:
>
> 1. A fix for hardcoded ':' as $PATH separator - use ';' on windows 
> (nobody's fault, the line comes from 1999 ;) )
>
> 2. Added KDIR_SEPARATOR (faster than non-inlined QDir::separator() -good 
> for low-level operations), a friend of KPATH_SEPARATOR.

Seems almost fine to me.

> @@ -277,12 +278,12 @@
>        // Environment PATH may contain filenames in 8bit locale cpecified
>        // encoding (Like a filenames).
>        QStringList dirs = QFile::decodeName(::getenv("PATH"))
> -	      .split(':',QString::SkipEmptyParts);
> +	      .split(KPATH_SEPARATOR,QString::SkipEmptyParts);
>        QStringList::Iterator it(dirs.begin());
>        bool match = false;
>        for (; it != dirs.end(); ++it) {
> -	QString fName = *it + '/' + te;
> -	if (::access(QFile::encodeName(fName), X_OK) == 0)
> +	QString fName = *it + KDIR_SEPARATOR + te;
> +	if (::access(QFile::encodeName(fName).constData(), X_OK) == 0)

Nitpick: The constData-change is unrelated to the rest, so should IMHO
be a separate commit.

Andreas

-- 
Afternoon very favorable for romance.  Try a single person for a change.




More information about the kde-core-devel mailing list