From 8f94aaa067426a259f5396abdaf4945671799b5c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 7 Sep 2015 15:49:44 +0200 Subject: Various fixes for rep-create --- bpkg/rep-create.cxx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'bpkg/rep-create.cxx') diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx index 1b8712a..bfa4776 100644 --- a/bpkg/rep-create.cxx +++ b/bpkg/rep-create.cxx @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -19,6 +20,7 @@ #include #include +#include #include using namespace std; @@ -32,10 +34,11 @@ namespace bpkg static void collect (package_map& map, const dir_path& d, const dir_path& root) + try { tracer trace ("collect"); - for (const dir_entry& de: dir_iterator (d)) + for (const dir_entry& de: dir_iterator (d)) // system_error { path p (de.path ()); @@ -47,7 +50,7 @@ namespace bpkg continue; } - switch (de.type ()) // Follow symlinks. + switch (de.type ()) // Follow symlinks, system_error. { case entry_type::directory: { @@ -174,6 +177,11 @@ namespace bpkg } } } + catch (const system_error& e) + { + error << "unable to scan directory " << d << ": " << e.what (); + throw failed (); + } void rep_create (const rep_create_options&, cli::scanner& args) @@ -192,7 +200,7 @@ namespace bpkg // path rf (d / path ("repositories")); - if (!file_exists (rf)) + if (!exists (rf)) fail << "file " << rf << " does not exist"; try @@ -249,13 +257,17 @@ namespace bpkg { fail << "unable to save manifest: " << e.description; } - catch (const ifdstream::failure&) + catch (const ofstream::failure&) { fail << "unable to write to " << p; } if (verb) - text << pm.size () << " package(s)"; + { + d.complete (); + d.normalize (); + text << pm.size () << " package(s) in " << d; + } } catch (const invalid_path& e) { -- cgit v1.1