diff --git a/src/common/utility.cpp b/src/common/utility.cpp index 61f2489e4255b..607bb0414ec7c 100644 --- a/src/common/utility.cpp +++ b/src/common/utility.cpp @@ -729,4 +729,11 @@ QString Utility::trailingSlashPath(const QString &path) return path.endsWith(slash) ? path : QString(path + slash); } +QString Utility::noLeadingSlashPath(const QString &path) +{ + static const auto slash = QLatin1Char('/'); + return path.startsWith(slash) ? path.mid(1) : path; +} + + } // namespace OCC diff --git a/src/common/utility.h b/src/common/utility.h index b554a196be189..e19f0da6ae1ee 100644 --- a/src/common/utility.h +++ b/src/common/utility.h @@ -256,6 +256,7 @@ namespace Utility { OCSYNC_EXPORT void registerUriHandlerForLocalEditing(); OCSYNC_EXPORT QString trailingSlashPath(const QString &path); + OCSYNC_EXPORT QString noLeadingSlashPath(const QString &path); #ifdef Q_OS_WIN OCSYNC_EXPORT bool registryKeyExists(HKEY hRootKey, const QString &subKey);