1 // tinygettext - A gettext replacement that works directly on .po files
2 // Copyright (C) 2009 Ingo Ruhnke <grumbel@gmx.de>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
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.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 #include "unix_file_system.hpp"
20 #include <sys/types.h>
27 namespace tinygettext {
29 UnixFileSystem::UnixFileSystem()
33 std::vector<std::string>
34 UnixFileSystem::open_directory(const std::string& pathname)
36 DIR* dir = opendir(pathname.c_str());
39 // FIXME: error handling
40 return std::vector<std::string>();
44 std::vector<std::string> files;
47 while((dp = readdir(dir)) != 0)
49 files.push_back(dp->d_name);
57 std::auto_ptr<std::istream>
58 UnixFileSystem::open_file(const std::string& filename)
60 return std::auto_ptr<std::istream>(new std::ifstream(filename.c_str()));
63 } // namespace tinygettext