aboutsummaryrefslogtreecommitdiff
path: root/mod/utility.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-09-05 21:23:41 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-09-08 17:44:57 +0300
commit70c1cdfd8f34472761fe5ec97f0713990c1b4f5b (patch)
treef2e631c10563bcc0cde07e4359c11b800a188d86 /mod/utility.hxx
parent3be834183ae36c321e4b560dce9a63cee846e63d (diff)
Add multi-tenancy support
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