diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-08-14 14:36:44 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-08-16 14:53:54 +0300 |
commit | ed437dbd3483baa3d15d1d86d8f057d9112653b1 (patch) | |
tree | cbf3974e8b1774ccccd818442cf042e501190b09 /bpkg/utility.cxx | |
parent | 80ee886ca0bd3e41434621a056125c92f31b1aea (diff) |
Add support for default options files
Diffstat (limited to 'bpkg/utility.cxx')
-rw-r--r-- | bpkg/utility.cxx | 38 |
1 files changed, 38 insertions, 0 deletions
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 |