diff mlk-map/mlk-map.c @ 554:cdbc13ceff85

rpg: do the same for map
author David Demelier <markand@malikania.fr>
date Tue, 07 Mar 2023 22:15:35 +0100
parents c2124ecb2423
children 944798a59b8a
line wrap: on
line diff
--- a/mlk-map/mlk-map.c	Tue Mar 07 20:58:00 2023 +0100
+++ b/mlk-map/mlk-map.c	Tue Mar 07 22:15:35 2023 +0100
@@ -212,8 +212,7 @@
 static void
 write_tileset(const json_t *tilesets)
 {
-	char path[MLK_PATH_MAX];
-	char filename[FILENAME_MAX] = {0}, *ext;
+	char path[MLK_PATH_MAX], *ext;
 	const json_t *tileset, *source;
 
 	if (json_array_size(tilesets) != 1)
@@ -227,14 +226,13 @@
 
 	/* We need to replace the .json extension to .tileset. */
 	snprintf(path, sizeof (path), "%s", json_string_value(source));
-	snprintf(filename, sizeof (filename), "%s", mlk_util_basename(path));
 
-	if (!(ext = strstr(filename, ".json")))
+	if (!(ext = strstr(path, ".json")))
 		die("could not determine tileset extension");
 
 	*ext = '\0';
 
-	printf("tileset|%s.tileset\n", filename);
+	printf("tileset|%s.tileset\n", path);
 }
 
 int