From ed437dbd3483baa3d15d1d86d8f057d9112653b1 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 14 Aug 2019 14:36:44 +0300 Subject: Add support for default options files --- bpkg/utility.cxx | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'bpkg/utility.cxx') diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx index 91fc49e..3cb9fb5 100644 --- a/bpkg/utility.cxx +++ b/bpkg/utility.cxx @@ -83,6 +83,44 @@ namespace bpkg } } + path& + normalize (path& f, const char* what) + { + try + { + f.complete ().normalize (); + } + catch (const invalid_path& e) + { + fail << "invalid " << what << " path " << e.path; + } + catch (const system_error& e) + { + fail << "unable to obtain current directory: " << e; + } + + return f; + } + + dir_path& + normalize (dir_path& d, const char* what) + { + try + { + d.complete ().normalize (); + } + catch (const invalid_path& e) + { + fail << "invalid " << what << " directory " << e.path; + } + catch (const system_error& e) + { + fail << "unable to obtain current directory: " << e; + } + + return d; + } + bool stderr_term; bool -- cgit v1.1