aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/command.c b/src/command.c
index 107df3275..c8f39472d 100644
--- a/src/command.c
+++ b/src/command.c
@@ -402,17 +402,18 @@ static int handleListPlaylistInfo(int fd, int *permission,
static int handleLsInfo(int fd, int *permission, int argc, char *argv[])
{
- if (argc == 1) {
- if (printDirectoryInfo(fd, NULL) < 0)
- return -1;
- else
- return lsPlaylists(fd, "");
- } else {
- if (printDirectoryInfo(fd, argv[1]) < 0)
- return -1;
- else
- return lsPlaylists(fd, argv[1]);
- }
+ char *path = "";
+
+ if (argc == 2)
+ path = argv[1];
+
+ if (printDirectoryInfo(fd, path) < 0)
+ return -1;
+
+ if (isRootDirectory(path))
+ return lsPlaylists(fd, path);
+
+ return 0;
}
static int handleRm(int fd, int *permission, int argc, char *argv[])