#include "KGF.h"


std::vector<std::string> ReturnFiles(std::string folder) {
  ALLEGRO_FS_ENTRY *directory;
  ALLEGRO_FS_ENTRY *file;
  std::vector<std::string> list;
  list.clear();

  directory = al_create_fs_entry(folder.c_str());

  if (al_open_directory(directory)) {
    while ((file=al_read_directory(directory)) != NULL) {
      if (al_fs_entry_is_file(file)) list.push_back(al_get_path_filename(al_get_fs_entry_name(file)));
      al_destroy_fs_entry(file);
    }
    al_close_directory(directory);
    al_destroy_fs_entry(directory);

    return list;
  }
  else {
    Error("No such directory " + folder);
  }
}
