summaryrefslogtreecommitdiff
path: root/source3/lib/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/util.c')
-rw-r--r--source3/lib/util.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 53200ad02a..c8f0c3121f 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -2435,6 +2435,39 @@ char *lib_path(const char *name)
}
/**
+ * @brief Returns an absolute path to a file in the Samba data directory.
+ *
+ * @param name File to find, relative to CODEPAGEDIR.
+ *
+ * @retval Pointer to a talloc'ed string containing the full path.
+ **/
+
+char *data_path(const char *name)
+{
+ return talloc_asprintf(talloc_tos(), "%s/%s", dyn_CODEPAGEDIR, name);
+}
+
+/*****************************************************************
+a useful function for returning a path in the Samba state directory
+ *****************************************************************/
+char *state_path(char *name)
+{
+ pstring fname;
+
+ pstrcpy(fname,dyn_STATEDIR());
+ trim_string(fname,"","/");
+
+ if (!directory_exist(fname,NULL)) {
+ mkdir(fname,0755);
+ }
+
+ pstrcat(fname,"/");
+ pstrcat(fname,name);
+
+ return talloc_strdup(talloc_tos(), fname);
+}
+
+/**
* @brief Returns the platform specific shared library extension.
*
* @retval Pointer to a static #fstring containing the extension.