Skip to content

Commit

Permalink
Improve handling of relative paths in UEFI.
Browse files Browse the repository at this point in the history
  • Loading branch information
stikonas committed Jan 1, 2024
1 parent ff47b1c commit c809024
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions uefi/uefi.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ char* _relative_path_to_absolute(char* narrow_string)
if(narrow_string[0] != '/' && narrow_string[0] != '\\')
{
strcat(absolute_path, _cwd);
if(_cwd[strlen(_cwd) - 1] != '/' && _cwd[strlen(_cwd) - 1] != '\\')
{
strcat(absolute_path, "/");
}
}
else
{
Expand All @@ -533,6 +537,11 @@ char* _posix_path_to_uefi(char* narrow_string)
if(absolute_path[i] == '/')
{
absolute_path[i] = '\\';
// Deal with /./ in paths, convert to . to \\\ which is fine in UEFI.
if((i < (length - 1)) && (absolute_path[i + 1] == '.') && (absolute_path[i + 2] == '/'))
{
absolute_path[i + 1] = '\\';
}
}
else
{
Expand Down

0 comments on commit c809024

Please sign in to comment.