Review Request: Clean up KUrl::setFileName and do not add a slash at the beginning when there is no slash in the path

Raphael Kubo da Costa kubito at
Sat Apr 4 21:55:43 BST 2009

This is an automatically generated e-mail. To reply, visit:

Review request for kdelibs.


Currently, if you have:

 KUrl test("foo.txt");

Then test.path() returns "foo.txt" and so does test.pathOrUrl(). But after you call test.setFileName("bar.txt"), test.path() and
test.pathOrUrl() both return "/bar.txt".

This patch makes setFileName not add this extra slash when there is no directory in the current path, and also cleans up some dead code.


  /trunk/KDE/kdelibs/kdecore/io/kurl.cpp 948757 



I have tested it with local files as in the example given in the description. Using a path like "" and later calling setFileName maintains its correct behaviour -- path() returns "/test/bar.txt" and pathOrUrl() returns "".



More information about the kde-core-devel mailing list