forked from qt-creator/qt-creator
Utils: Avoid one case of passing an empty path to isRelativePath()
The distiction relative/absolute path is not broad enough to cover all situations like e.g. Windows paths with drive letter but not starting with backslash, and generally also rarely needed in user code. The situation doesn't get better with "convenience defaults", like empty path meaning depending on context. Mid-term I'd like to ramp down uses in user code, moving corner-case handling to filepath.cpp behind "higher level" FilePath API. This here is one step towards this goal. Change-Id: I070112810a1628ced035e90cc7dc679e2248d688 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -1573,6 +1573,8 @@ bool FilePath::isRelativePath() const
|
||||
*/
|
||||
FilePath FilePath::resolvePath(const FilePath &tail) const
|
||||
{
|
||||
if (tail.isEmpty())
|
||||
return cleanPath();
|
||||
if (tail.isRelativePath())
|
||||
return pathAppended(tail.path()).cleanPath();
|
||||
return tail;
|
||||
|
||||
Reference in New Issue
Block a user