Commit 03726aef5300c3376855dd0313e51d3481aca97d

Thomas de Grivel 2024-07-17T17:46:26

fix file_dirname for last slash/

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/libkc3/file.c b/libkc3/file.c
index 88d5b3e..82a749e 100644
--- a/libkc3/file.c
+++ b/libkc3/file.c
@@ -118,7 +118,7 @@ s_str * file_dirname (const s_str *path, s_str *dest)
     return str_init(dest, NULL, 2, "./");
   if (! dirsep_pos)
     return str_init(dest, NULL, 1, "/");
-  return str_init_slice(dest, path, 0, dirsep_pos);
+  return str_init_slice(dest, path, 0, dirsep_pos + 1);
 }
 
 s_tag * file_mtime (const s_str *path, s_tag *dest)