Don't list playlists in lsinfo if the path isn't the root directory (they
can't be loaded anyway). git-svn-id: https://svn.musicpd.org/mpd/trunk@6244 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
		@@ -402,17 +402,18 @@ static int handleListPlaylistInfo(int fd, int *permission,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static int handleLsInfo(int fd, int *permission, int argc, char *argv[])
 | 
					static int handleLsInfo(int fd, int *permission, int argc, char *argv[])
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (argc == 1) {
 | 
						char *path = "";
 | 
				
			||||||
		if (printDirectoryInfo(fd, NULL) < 0)
 | 
					
 | 
				
			||||||
			return -1;
 | 
						if (argc == 2)
 | 
				
			||||||
		else
 | 
							path = argv[1];
 | 
				
			||||||
			return lsPlaylists(fd, "");
 | 
					
 | 
				
			||||||
	} else {
 | 
						if (printDirectoryInfo(fd, path) < 0)
 | 
				
			||||||
		if (printDirectoryInfo(fd, argv[1]) < 0)
 | 
							return -1;
 | 
				
			||||||
			return -1;
 | 
					
 | 
				
			||||||
		else
 | 
						if (isRootDirectory(path))
 | 
				
			||||||
			return lsPlaylists(fd, argv[1]);
 | 
							return lsPlaylists(fd, path);
 | 
				
			||||||
	}
 | 
					
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int handleRm(int fd, int *permission, int argc, char *argv[])
 | 
					static int handleRm(int fd, int *permission, int argc, char *argv[])
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -835,13 +835,21 @@ static Directory *findSubDirectory(Directory * directory, char *name)
 | 
				
			|||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int isRootDirectory(char *name)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						if (name == NULL || name[0] == '\0' || strcmp(name, "/") == 0) {
 | 
				
			||||||
 | 
							return 1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Directory *getSubDirectory(Directory * directory, char *name,
 | 
					static Directory *getSubDirectory(Directory * directory, char *name,
 | 
				
			||||||
				  char **shortname)
 | 
									  char **shortname)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Directory *subDirectory;
 | 
						Directory *subDirectory;
 | 
				
			||||||
	int len;
 | 
						int len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (name == NULL || name[0] == '\0' || strcmp(name, "/") == 0) {
 | 
						if (isRootDirectory(name)) {
 | 
				
			||||||
		return directory;
 | 
							return directory;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,6 +51,8 @@ void initMp3Directory(void);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void closeMp3Directory(void);
 | 
					void closeMp3Directory(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int isRootDirectory(char *name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int printDirectoryInfo(int fd, char *dirname);
 | 
					int printDirectoryInfo(int fd, char *dirname);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int checkDirectoryDB(void);
 | 
					int checkDirectoryDB(void);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user