Commit 7556587a authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen
Browse files

fs: Directory: Remove superfluous heap alloc

parent 5fca29df
...@@ -72,15 +72,15 @@ std::shared_ptr<IDevice> Directory::device() const ...@@ -72,15 +72,15 @@ std::shared_ptr<IDevice> Directory::device() const
std::string Directory::toAbsolute(const std::string& path) std::string Directory::toAbsolute(const std::string& path)
{ {
auto abs = std::unique_ptr<char[]>( new char[PATH_MAX] ); char abs[PATH_MAX];
if ( realpath( path.c_str(), abs.get() ) == nullptr ) if ( realpath( path.c_str(), abs ) == nullptr )
{ {
std::string err( "Failed to convert to absolute path" ); std::string err( "Failed to convert to absolute path" );
err += "(" + path + "): "; err += "(" + path + "): ";
err += strerror(errno); err += strerror(errno);
throw std::runtime_error( err ); throw std::runtime_error( err );
} }
return std::string{ abs.get() }; return std::string{ abs };
} }
void Directory::read() void Directory::read()
......
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