Fixed FilePath behavior with trailing slash.

This commit is contained in:
Branimir Karadžić
2017-11-16 22:31:24 -08:00
parent 4dbcbc2167
commit 0c1354aacc
2 changed files with 22 additions and 10 deletions

View File

@@ -61,6 +61,8 @@ namespace bx
dotdot = size;
}
bool trailingSlash = false;
while (idx < num && err.isOk() )
{
switch (_src[idx])
@@ -68,6 +70,7 @@ namespace bx
case '/':
case '\\':
++idx;
trailingSlash = idx == num;
break;
case '.':
@@ -129,6 +132,11 @@ namespace bx
size += write(&writer, '.', &err);
}
if (trailingSlash)
{
size += write(&writer, '/', &err);
}
write(&writer, '\0', &err);
return size;
@@ -326,6 +334,8 @@ namespace bx
{
return StringView(fileName.getPtr(), ext);
}
return fileName;
}
return StringView();