diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/zen/cmds/workspaces_cmd.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/zen/cmds/workspaces_cmd.cpp b/src/zen/cmds/workspaces_cmd.cpp index 05d3c573f..166d4218d 100644 --- a/src/zen/cmds/workspaces_cmd.cpp +++ b/src/zen/cmds/workspaces_cmd.cpp @@ -25,7 +25,7 @@ namespace { if (!Path.empty()) { std::u8string PathString = Path.u8string(); - if (PathString.ends_with(std::filesystem::path::preferred_separator)) + if (PathString.ends_with(std::filesystem::path::preferred_separator) || PathString.ends_with('/')) { PathString.pop_back(); Path = std::filesystem::path(PathString); @@ -42,6 +42,19 @@ namespace { } } + static void RemoveLeadingPathSeparator(std::filesystem::path& Path) + { + if (!Path.empty()) + { + std::u8string PathString = Path.u8string(); + if (PathString.starts_with(std::filesystem::path::preferred_separator) || PathString.starts_with('/')) + { + PathString.erase(PathString.begin()); + Path = std::filesystem::path(PathString); + } + } + } + void ShowShare(const Workspaces::WorkspaceShareConfiguration& Share, const Oid& WorkspaceId, std::string_view Prefix) { ZEN_CONSOLE("{}Id: {}", Prefix, Share.Id); @@ -451,6 +464,7 @@ WorkspaceShareCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** } RemoveTrailingPathSeparator(m_SharePath); + RemoveLeadingPathSeparator(m_SharePath); if (m_ShareId.empty()) { |