QStandardPaths: remove trailing slash when reading from user-dirs.dirs

For consistency with all other sources of paths, which do not return
a trailing slash, as tested by the unittest. This avoids double slashes
in paths, after apps append something to the path.

Change-Id: Iabcde11eee27df0b185780e2b655fbbb02ed63b5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
David Faure 2014-02-07 10:25:31 +01:00 committed by The Qt Project
parent 3e8af132df
commit 85498fdede

View File

@ -205,6 +205,8 @@ QString QStandardPaths::writableLocation(StandardLocation type)
// value can start with $HOME
if (value.startsWith(QLatin1String("$HOME")))
value = QDir::homePath() + value.mid(5);
if (value.length() > 1 && value.endsWith(QLatin1Char('/')))
value.chop(1);
return value;
}
}