diff options
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 |