Commit 14da7c73 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

fs: Directory: Expose the absolute path

parent 41f356c5
......@@ -11,6 +11,8 @@ namespace fs
{
public:
virtual ~IDirectory() = default;
// Returns the absolute path to this directory
virtual const std::string& path() const = 0;
virtual std::vector<std::unique_ptr<IFile>> files() const = 0;
};
......
......@@ -33,6 +33,11 @@ Directory::Directory( const std::string& path )
{
}
const std::string&Directory::path() const
{
return m_path;
}
std::vector<std::unique_ptr<IFile>> Directory::files() const
{
auto dir = std::unique_ptr<DIR, int(*)(DIR*)>( opendir( m_path.c_str() ), closedir );
......
......@@ -10,6 +10,7 @@ class Directory : public IDirectory
{
public:
explicit Directory( const std::string& path );
virtual const std::string& path() const override;
virtual std::vector<std::unique_ptr<IFile>> files() const override;
public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment