Commit 22645abc authored by Max Kellermann's avatar Max Kellermann

directory: fix update in root directory

Commit 0bfe7802 broke update for new files in the root directory, because music_root->path was an empty string and not NULL. There were some NULL tests missing. Change them to !isRootDirectory(path) instead of path!=NULL.
parent e8413541
...@@ -61,7 +61,7 @@ static int ...@@ -61,7 +61,7 @@ static int
printDirectoryInDirectory(struct directory *directory, void *data) printDirectoryInDirectory(struct directory *directory, void *data)
{ {
struct client *client = data; struct client *client = data;
if (directory->path) { if (!isRootDirectory(directory->path)) {
client_printf(client, "directory: %s\n", directory_get_path(directory)); client_printf(client, "directory: %s\n", directory_get_path(directory));
} }
return 0; return 0;
...@@ -371,7 +371,7 @@ sumSavedFilenameMemoryInDirectory(struct directory *dir, void *data) ...@@ -371,7 +371,7 @@ sumSavedFilenameMemoryInDirectory(struct directory *dir, void *data)
{ {
int *sum = data; int *sum = data;
if (!dir->path) if (isRootDirectory(dir->path))
return 0; return 0;
*sum += (strlen(directory_get_path(dir)) + 1 *sum += (strlen(directory_get_path(dir)) + 1
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
void void
song_print_url(struct client *client, struct song *song) song_print_url(struct client *client, struct song *song)
{ {
if (song->parent && song->parent->path) { if (song->parent && !isRootDirectory(song->parent->path)) {
client_printf(client, "%s%s/%s\n", SONG_FILE, client_printf(client, "%s%s/%s\n", SONG_FILE,
directory_get_path(song->parent), song->url); directory_get_path(song->parent), song->url);
} else { } else {
......
...@@ -291,7 +291,7 @@ updateDirectory(struct directory *directory) ...@@ -291,7 +291,7 @@ updateDirectory(struct directory *directory)
if (!utf8) if (!utf8)
continue; continue;
if (directory->path) if (!isRootDirectory(directory->path))
utf8 = pfx_dir(path_max_tmp, utf8, strlen(utf8), utf8 = pfx_dir(path_max_tmp, utf8, strlen(utf8),
dirname, strlen(dirname)); dirname, strlen(dirname));
if (was_empty) { if (was_empty) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment