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
Sun Apr 5 17:27:45 BST 2009

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

(Updated 2009-04-05 09:27:45.389952)

Review request for kdelibs.


Implemented regression test for the fix as suggested by Peter Obemdorfer.


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.

Diffs (updated)

  /trunk/KDE/kdelibs/kdecore/io/kurl.cpp 948757 
  /trunk/KDE/kdelibs/kdecore/tests/kurltest.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