aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/zen/cmds/workspaces_cmd.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/zen/cmds/workspaces_cmd.cpp b/src/zen/cmds/workspaces_cmd.cpp
index b5d9af1be..2c8fe43f6 100644
--- a/src/zen/cmds/workspaces_cmd.cpp
+++ b/src/zen/cmds/workspaces_cmd.cpp
@@ -20,6 +20,16 @@
namespace zen {
namespace {
+ static void RemoveTrailingPathSeparator(std::filesystem::path& Path)
+ {
+ std::u8string PathString = Path.u8string();
+ if (PathString.ends_with(std::filesystem::path::preferred_separator))
+ {
+ PathString.pop_back();
+ Path = std::filesystem::path(PathString);
+ }
+ }
+
void ShowShare(const Workspaces::WorkspaceShareConfiguration& Share, const Oid& WorkspaceId, std::string_view Prefix)
{
ZEN_CONSOLE("{}Id: {}", Prefix, Share.Id);
@@ -136,6 +146,8 @@ WorkspaceCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
throw zen::OptionParseException(fmt::format("path is required\n{}", m_CreateOptions.help()));
}
+ RemoveTrailingPathSeparator(m_Path);
+
if (m_Id.empty())
{
m_Id = Workspaces::PathToId(m_Path).ToString();
@@ -403,6 +415,7 @@ WorkspaceShareCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char**
}
else
{
+ RemoveTrailingPathSeparator(m_WorkspaceRoot);
if (m_WorkspaceId.empty())
{
m_WorkspaceId = Workspaces::PathToId(m_WorkspaceRoot).ToString();
@@ -425,6 +438,8 @@ WorkspaceShareCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char**
}
}
+ RemoveTrailingPathSeparator(m_SharePath);
+
if (m_ShareId.empty())
{
m_ShareId = Workspaces::PathToId(m_SharePath).ToString();