When path1 was empty (i.e. 'current directory'), concatPaths() used to
return an absolute path /path2 instead of just path2, which broke e.g.
KUrlCompletion in certain cases.
This commit makes concatPaths() return just path2 if path1 is empty.
anthonyfieroni | |
dfaure |
Frameworks |
When path1 was empty (i.e. 'current directory'), concatPaths() used to
return an absolute path /path2 instead of just path2, which broke e.g.
KUrlCompletion in certain cases.
This commit makes concatPaths() return just path2 if path1 is empty.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Here is an example of KUrlCompletion breakage.
Before, it returned invalid absolute paths like /Desktop etc.:
Hm... I thought concatPaths() is supposed to be used like this: concatPaths(basePath, relativePath) - then an empty basePath makes sense (and means 'current directory', like in $ cd Desktop). If this is not the case, then:
Is this correct?
Q_ASSERT(!path2.startsWith(QLatin1Char('/')));
If path1 is empty path2 will point to full path not absolute e.g. /something it should be ./something.
// Edit: Misreading, path1 can be empty, so you are right.
+1 from me.
OK, so concatPaths returns absolute paths if path1 is absolute, and relative paths if path1 is relative. Makes sense, but should be documented.