From 26a42f71564fb97d5dba924f681e70fedcf6af46 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 21 Sep 2015 14:14:08 +0200 Subject: Expand and clarify empty repository_location --- bpkg/manifest.cxx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'bpkg/manifest.cxx') diff --git a/bpkg/manifest.cxx b/bpkg/manifest.cxx index b66d5d4..1034fe3 100644 --- a/bpkg/manifest.cxx +++ b/bpkg/manifest.cxx @@ -832,7 +832,7 @@ namespace bpkg repository_location (const std::string& l) : repository_location (l, repository_location ()) // Delegate. { - if (relative ()) + if (!empty () && relative ()) throw invalid_argument ("relative filesystem path"); } @@ -843,6 +843,14 @@ namespace bpkg // using std::string; + if (l.empty ()) + { + if (!b.empty ()) + throw invalid_argument ("empty location"); + + return; + } + // Base repository location can not be a relative path. // if (!b.empty () && b.relative ()) @@ -971,9 +979,6 @@ namespace bpkg { path_ = dir_path (l); - if (path_.empty ()) - throw invalid_argument ("empty location"); - // Complete if we are relative and have base. // if (!b.empty () && path_.relative ()) @@ -1052,13 +1057,15 @@ namespace bpkg string repository_location:: string () const { + using std::string; // Also function name. + if (empty ()) - return ""; + return string (); if (local ()) return path_.string (); - std::string p ("http://" + host_); + string p ("http://" + host_); if (port_ != 0) p += ":" + to_string (port_); -- cgit v1.1