1// SuperTux
2// Copyright (C) 2009 Ingo Ruhnke <grumbel@gmail.com>
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17#include "physfs/physfs_file_system.hpp"
18
19#include <physfs.h>
20
21#include "physfs/ifile_stream.hpp"
22
23PhysFSFileSystem::PhysFSFileSystem()
24{
25}
26
27std::vector<std::string>
28PhysFSFileSystem::open_directory(const std::string& pathname)
29{
30 std::vector<std::string> files;
31
32 char** directory = PHYSFS_enumerateFiles(pathname.c_str());
33 for (char** i = directory; *i != nullptr; ++i)
34 {
35 files.push_back(*i);
36 }
37 PHYSFS_freeList(directory);
38
39 return files;
40}
41
42std::unique_ptr<std::istream>
43PhysFSFileSystem::open_file(const std::string& filename)
44{
45 return std::make_unique<IFileStream>(filename);
46}
47
48/* EOF */
49