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/utility.cxx | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 bpkg/utility.cxx (limited to 'bpkg/utility.cxx') diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx new file mode 100644 index 0000000..c274563 --- /dev/null +++ b/bpkg/utility.cxx @@ -0,0 +1,46 @@ +// file : bpkg/utility.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include + +#include + +#include + +#include +#include + +using namespace std; +using namespace butl; + +namespace bpkg +{ + bool + exists (const path& f) + { + try + { + return file_exists (f); + } + catch (const system_error& e) + { + error << "unable to stat path " << f << ": " << e.what (); + throw failed (); + } + } + + bool + exists (const dir_path& d) + { + try + { + return file_exists (d); + } + catch (const system_error& e) + { + error << "unable to stat path " << d << ": " << e.what (); + throw failed (); + } + } +} -- cgit v1.1