diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-21 14:14:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-21 14:14:08 +0200 |
commit | 26a42f71564fb97d5dba924f681e70fedcf6af46 (patch) | |
tree | c7433690a90824a80ac92c1706cdb6edae2bf2d4 /bpkg/manifest.cxx | |
parent | 450702a232bf07a82c6ac74fe28dc7bc9cffe67c (diff) |
Expand and clarify empty repository_location
Diffstat (limited to 'bpkg/manifest.cxx')
-rw-r--r-- | bpkg/manifest.cxx | 19 |
1 files changed, 13 insertions, 6 deletions
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_); |