Skip to content

Commit efb4731

Browse files
committed
respect leading slashes in bake file path tree lookup
1 parent ed57428 commit efb4731

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/lib_rdi_make/rdi_make.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,12 +1904,26 @@ rdim_bake_path_node_from_string(RDIM_BakePathTree *tree, RDIM_String8 string)
19041904
RDI_U8 *opl = string.str + string.size;
19051905
for(;ptr < opl && node != 0;)
19061906
{
1907-
// rjf: skip past slashes
1908-
for(;ptr < opl && (*ptr == '/' || *ptr == '\\'); ptr += 1);
1907+
// rjf: skip past non-leading slashes
1908+
RDI_U32 leading_slash = 0;
1909+
if(ptr > string.str)
1910+
{
1911+
for(;ptr < opl && (*ptr == '/' || *ptr == '\\'); ptr += 1);
1912+
}
1913+
else if(ptr < opl)
1914+
{
1915+
leading_slash = (*ptr == '/');
1916+
}
19091917

19101918
// rjf: save beginning of non-slash range
19111919
RDI_U8 *range_first = ptr;
19121920

1921+
// rjf: advance past leading slash
1922+
if(leading_slash)
1923+
{
1924+
ptr += 1;
1925+
}
1926+
19131927
// rjf: skip past non-slashes
19141928
for(;ptr < opl && !(*ptr == '/' || *ptr == '\\'); ptr += 1);
19151929

0 commit comments

Comments
 (0)