mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-05 15:56:49 +00:00
VFS: Escape path components which end with space or period
This commit is contained in:
parent
11db3151ae
commit
d1e1c14dc3
@ -450,6 +450,24 @@ std::string vfs::escape(std::string_view name, bool escape_slash)
|
||||
result += c;
|
||||
break;
|
||||
}
|
||||
case '.':
|
||||
case ' ':
|
||||
{
|
||||
if (!get_char(i + 1))
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
// Directory name ended with a space or a period, not allowed on Windows.
|
||||
case '.': result += reinterpret_cast<const char*>(u8"."); break;
|
||||
case ' ': result += reinterpret_cast<const char*>(u8"_"); break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
result += c;
|
||||
break;
|
||||
}
|
||||
case char2{u8"!"[0]}:
|
||||
{
|
||||
// Escape full-width characters 0xFF01..0xFF5e with ! (0xFF01)
|
||||
@ -585,6 +603,11 @@ std::string vfs::unescape(std::string_view name)
|
||||
i += 3;
|
||||
continue;
|
||||
}
|
||||
case char2{u8"_"[2]}:
|
||||
{
|
||||
result += ' ';
|
||||
break;
|
||||
}
|
||||
case char2{u8"."[2]}:
|
||||
{
|
||||
result += '.';
|
||||
|
Loading…
Reference in New Issue
Block a user