From c44b9f7151a047cde5edd369f9adb09518a0bc6f Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Wed, 4 Jun 2025 14:03:55 +0200 Subject: builds download url (#419) * RemoveQuotes helper * `--url` option for `zen builds` command has been reworked to accept a "Cloud Artifact URL", removing the need to specify "host", "namespace" and "bucket" separately --- src/zenutil/commandlineoptions.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/zenutil/commandlineoptions.cpp') diff --git a/src/zenutil/commandlineoptions.cpp b/src/zenutil/commandlineoptions.cpp index 0dffa42f0..afef7f6f2 100644 --- a/src/zenutil/commandlineoptions.cpp +++ b/src/zenutil/commandlineoptions.cpp @@ -157,12 +157,7 @@ MakeSafeAbsolutePath(const std::filesystem::path& Path) std::filesystem::path StringToPath(const std::string_view& Path) { - std::string_view UnquotedPath = Path; - - if (UnquotedPath.length() > 2 && UnquotedPath.front() == '\"' && UnquotedPath.back() == '\"') - { - UnquotedPath = UnquotedPath.substr(1, UnquotedPath.length() - 2); - } + std::string_view UnquotedPath = RemoveQuotes(Path); if (UnquotedPath.ends_with('/') || UnquotedPath.ends_with('\\') || UnquotedPath.ends_with(std::filesystem::path::preferred_separator)) { @@ -172,6 +167,19 @@ StringToPath(const std::string_view& Path) return std::filesystem::path(UnquotedPath).make_preferred(); } +std::string_view +RemoveQuotes(const std::string_view& Arg) +{ + if (Arg.length() > 2) + { + if (Arg[0] == '"' && Arg[Arg.length() - 1] == '"') + { + return Arg.substr(1, Arg.length() - 2); + } + } + return Arg; +} + #if ZEN_WITH_TESTS void -- cgit v1.2.3