mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +00:00
LibCore: Add Core::File::real_path_for()
A slightly convenient wrapper around realpath(3).
This commit is contained in:
@@ -119,4 +119,15 @@ bool File::exists(const String& filename)
|
||||
return stat(filename.characters(), &st) == 0;
|
||||
}
|
||||
|
||||
String File::real_path_for(const String& filename)
|
||||
{
|
||||
if (filename.is_null())
|
||||
return {};
|
||||
auto* path = realpath(filename.characters(), nullptr);
|
||||
String real_path(path);
|
||||
free(path);
|
||||
return real_path;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user