summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-06-17 03:13:59 +0200
committerLennart Poettering <lennart@poettering.net>2009-06-17 03:13:59 +0200
commit0fa1ddf8380d6b86bd7e911ac6db7771dcb14dd6 (patch)
tree62db619de703b4cb453d0e78e7eda50d58bcf5c5 /src
parent7fa05bea7e9980243cf58902b9d42e995d1a18bf (diff)
core-util: implement pa_maybe_prefix_path()
Diffstat (limited to 'src')
-rw-r--r--src/pulsecore/core-util.c9
-rw-r--r--src/pulsecore/core-util.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index e39adb12..a71ba0b0 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -2768,3 +2768,12 @@ char **pa_split_spaces_strv(const char *s) {
t[i] = NULL;
return t;
}
+
+char* pa_maybe_prefix_path(const char *path, const char *prefix) {
+ pa_assert(path);
+
+ if (pa_is_path_absolute(path))
+ return pa_xstrdup(path);
+
+ return pa_sprintf_malloc("%s" PA_PATH_SEP "%s", prefix, path);
+}
diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
index d88b7cbb..b841edbb 100644
--- a/src/pulsecore/core-util.h
+++ b/src/pulsecore/core-util.h
@@ -237,4 +237,6 @@ static inline void pa_xstrfreev(char **a) {
char **pa_split_spaces_strv(const char *s);
+char* pa_maybe_prefix_path(const char *path, const char *prefix);
+
#endif