From 3d5901b73cc4e46e57233ea3ccc9b27ffba4c7df Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sun, 2 Jan 2011 01:16:35 +0100 Subject: Moved MusicDirectory conversion code to music::get_directory(). --- commands.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'commands.cpp') diff --git a/commands.cpp b/commands.cpp index 2401690..f37f78c 100644 --- a/commands.cpp +++ b/commands.cpp @@ -1,7 +1,6 @@ #include "commands.h" #include "music.h" -#include #include #include @@ -12,12 +11,12 @@ static std::vector ls(const std::vector& args) { throw commands::CommandException("usage: ls DIR"); } - MusicListing::p ml = music::get(args[1]); - if(!ml || !fs::is_directory(ml->path)) { + MusicDirectory::p dir = music::get_directory(args[1]); + if(!dir) { throw commands::CommandException("no such directory"); } + std::cout << dir->path << std::endl; std::vector result; - MusicDirectory *dir = boost::polymorphic_downcast(&(*ml)); for(MusicDirectory::PathListings::iterator it = dir->directories.begin(); it != dir->directories.end(); it++) { std::string rel_path = it->string().substr(music::root_directory.string().size()); result.push_back(rel_path); -- cgit v1.2.3