summaryrefslogtreecommitdiff
path: root/src/shared/path-util.h
diff options
context:
space:
mode:
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>2014-05-03 11:52:12 +0300
committerLennart Poettering <lennart@poettering.net>2014-05-16 18:47:34 +0200
commit7cb9c51ce81818c200f27de4db4a4076cbe4265b (patch)
treee7f350750c6cda8e02ae585629214d150afaf39c /src/shared/path-util.h
parentf1f0198cb61a3398557cc9ec596e1e90ac731ed3 (diff)
path-util: add path_make_relative()
In user_dirs() in path-lookup.c, I want to replace this: symlink("../../../.config/systemd/user", data_home); with symlink(config_home, data_home); to avoid hardcoding .config when XDG_CONFIG_HOME is set. The problem is that config_home is an absolute path, and it's better to make the symlink relative. path_make_relative() is an utility function that converts an absolute path into a relative one.
Diffstat (limited to 'src/shared/path-util.h')
-rw-r--r--src/shared/path-util.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/shared/path-util.h b/src/shared/path-util.h
index fdf1f6b000..6882d7866b 100644
--- a/src/shared/path-util.h
+++ b/src/shared/path-util.h
@@ -41,6 +41,7 @@ int path_get_parent(const char *path, char **parent);
bool path_is_absolute(const char *p) _pure_;
char* path_make_absolute(const char *p, const char *prefix);
char* path_make_absolute_cwd(const char *p);
+int path_make_relative(const char *from_dir, const char *to_path, char **_r);
char* path_kill_slashes(char *path);
char* path_startswith(const char *path, const char *prefix) _pure_;
bool path_equal(const char *a, const char *b) _pure_;