return 0;
}
-int runtime_directory_generic(RuntimeScope scope, const char *suffix, char **ret) {
- int r;
+int config_directory_generic(RuntimeScope scope, const char *suffix, char **ret) {
+ assert(ret);
+
+ /* This does not bother with $CONFIGURATION_DIRECTORY, and hence can be applied to get other
+ * service's config dir */
+
+ switch (scope) {
+ case RUNTIME_SCOPE_USER:
+ return xdg_user_config_dir(suffix, ret);
+ case RUNTIME_SCOPE_SYSTEM: {
+ char *d = path_join("/etc", suffix);
+ if (!d)
+ return -ENOMEM;
+ *ret = d;
+ return 0;
+ }
+
+ default:
+ return -EINVAL;
+ }
+}
+
+int runtime_directory_generic(RuntimeScope scope, const char *suffix, char **ret) {
assert(ret);
/* This does not bother with $RUNTIME_DIRECTORY, and hence can be applied to get other service's
switch (scope) {
case RUNTIME_SCOPE_USER:
- r = xdg_user_runtime_dir(suffix, ret);
- if (r < 0)
- return r;
- break;
+ return xdg_user_runtime_dir(suffix, ret);
case RUNTIME_SCOPE_SYSTEM: {
char *d = path_join("/run", suffix);
if (!d)
return -ENOMEM;
*ret = d;
- break;
+ return 0;
}
default:
return -EINVAL;
}
-
- return 0;
}
int runtime_directory(RuntimeScope scope, const char *fallback_suffix, char **ret) {
void lookup_paths_log(LookupPaths *p);
void lookup_paths_done(LookupPaths *p);
+int config_directory_generic(RuntimeScope scope, const char *suffix, char **ret);
int runtime_directory_generic(RuntimeScope scope, const char *suffix, char **ret);
int runtime_directory(RuntimeScope scope, const char *fallback_suffix, char **ret);