aboutsummaryrefslogtreecommitdiff
path: root/mod/utility.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'mod/utility.hxx')
-rw-r--r--mod/utility.hxx25
1 files changed, 25 insertions, 0 deletions
diff --git a/mod/utility.hxx b/mod/utility.hxx
new file mode 100644
index 0000000..2ce1e07
--- /dev/null
+++ b/mod/utility.hxx
@@ -0,0 +1,25 @@
+// file : mod/utility.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef MOD_UTILITY_HXX
+#define MOD_UTILITY_HXX
+
+#include <libbrep/types.hxx>
+#include <libbrep/utility.hxx>
+
+namespace brep
+{
+ // Append the @<tenant> leaf component to the directory if the tenant is
+ // not empty. Otherwise, return the directory unchanged.
+ //
+ inline dir_path
+ tenant_dir (const dir_path& dir, const string& tenant)
+ {
+ return !tenant.empty ()
+ ? path_cast<dir_path> (dir / ('@' + tenant))
+ : dir;
+ }
+}
+
+#endif // MOD_UTILITY_HXX