[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Generalizing KStandardDirs::findResource()
From:       Luke Sandell <ls65594 () appstate ! edu>
Date:       2006-01-30 23:02:15
Message-ID: 200601302302.15401.ls65594 () appstate ! edu
[Download RAW message or body]

This post pertains to the KStandardDirs::findResource() member function. 
Looking at the source, the first statement is as follows:

if (!QDir::isRelativePath(filename))
	return filename; // absolute dirs are absolute dirs, right? :-/

This is a nice check, but unfortunately I don't think it makes much sense. I 
can't really think of many cases in which the programmer would pass an 
absolute path into findResource(). On the other hand, consider the following 
code segment:

QString wallpaper_dir = KGlobal::dirs()->findResource("wallpaper", "/");

The programmer expects it to return the directory in which wallpapers are 
stored, but unfortunately "/" is interpreted as an absolute path, so "/" is 
all that is returned. Contrast this with

QString konq_dir = KGlobal::dirs()->findResource("data", "konqueror/");

Which obviously returns the correct result.

Thus, it seems to me that the absolute path check should be eliminated.

-Luke Sandell
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic