Skip to content

Commit

Permalink
Add utility method to remove leading slashes from paths
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra authored and mgallien committed Oct 11, 2023
1 parent 2ebe3d9 commit 1012a0b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/common/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions src/common/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1012a0b

Please sign in to comment.