summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorVincent Douillet <vincent@vdouillet.fr>2024-08-29 17:46:14 +0200
committerVincent Douillet <vincent@vdouillet.fr>2024-08-29 21:53:35 +0200
commitf005928d63165d28b32851f04f29055a4d0cdad5 (patch)
tree5386f28a558046dbe6e93b439f5e026441224c56 /file.c
parent4be89075c5bb5793f8c79da8f8df1accc1f0168f (diff)
get data dir from env variable
Diffstat (limited to 'file.c')
-rw-r--r--file.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/file.c b/file.c
index be044ca..5785805 100644
--- a/file.c
+++ b/file.c
@@ -64,16 +64,20 @@ file_free(struct file * file)
static bool
fill_metadata(struct file * f)
{
- char *ext;
+ char *ext, *data_dir;
char path[PATH_MAX];
struct stat sb;
size_t path_len;
+ data_dir = config_data_dir();
+ if (data_dir == NULL)
+ return false;
+
/* default mime */
f->mime = MIME__MAX;
/* check if it is a directory */
- path_len = url_build(path, PATH_MAX, DATA_DIR, f->path, f->name, NULL);
+ path_len = url_build(path, PATH_MAX, data_dir, f->path, f->name, NULL);
if (path_len == 0 || path_len >= PATH_MAX)
return false;