share/gui: don't use less of widget width for truncation than available
[neverball] / share / dir.c
index 2f33d0f..ff19407 100644 (file)
@@ -63,7 +63,7 @@ static struct dir_item *add_item(Array items, const char *dir, const char *name)
 {
     struct dir_item *item = array_add(items);
 
-    item->path = concat_string(dir, "/", name, NULL);
+    item->path = *dir ? concat_string(dir, "/", name, NULL) : strdup(name);
     item->data = NULL;
 
     return item;
@@ -141,4 +141,6 @@ void dir_free(Array items)
 {
     while (array_len(items))
         del_item(items);
+
+    array_free(items);
 }