From 9341733b3759b8fd2340cc539a041d5f08c1edb7 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 21 Jun 2022 15:50:11 +0200 Subject: [PATCH] Utils: Document escaping rules for % and / in FilePath Change-Id: Ief9e739e167f724b1626c3478ac4d6f94fc3bac0 Reviewed-by: Christian Stenger Reviewed-by: Eike Ziller Reviewed-by: --- src/libs/utils/filepath.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp index 14436bdc1d1..4c903640f79 100644 --- a/src/libs/utils/filepath.cpp +++ b/src/libs/utils/filepath.cpp @@ -945,8 +945,30 @@ QString FilePath::displayName(const QString &args) const .arg(m_data, args, deviceName); } -/// Constructs a FilePath from \a filename -/// \a filename is not checked for validity. +/*! + Constructs a FilePath from \a filepath + + \a filepath is not checked for validity. It can be given in the following forms: + + \list + \li /some/absolute/local/path + \li some/relative/path + \li scheme://host/absolute/path + \li scheme://host/./relative/path \note the ./ is verbatim part of the path + \endlist + + Some decoding happens when parsing the \a filepath + A sequence %25 present in the host part is replaced by % in the host name, + a sequence %2f present in the host part is replaced by / in the host name. + + The path part might consist of several parts separated by /, independent + of the platform or file system. + + To create FilePath objects from strings possibly containing backslashes as + path separator, use \c fromUserInput. + + \sa toString, fromUserInput + */ FilePath FilePath::fromString(const QString &filepath) { FilePath fn;