Reduce string allocations

Some simple changes to reduce the number of allocated strings
This commit is contained in:
Bond_009
2023-10-06 00:40:09 +02:00
parent 40f7eb4e8c
commit b176beb88e
21 changed files with 63 additions and 97 deletions

View File

@@ -103,15 +103,17 @@ namespace Emby.Server.Implementations.IO
return filePath;
}
var filePathSpan = filePath.AsSpan();
// relative path
if (firstChar == '\\')
{
filePath = filePath.Substring(1);
filePathSpan = filePathSpan.Slice(1);
}
try
{
return Path.GetFullPath(Path.Combine(folderPath, filePath));
return Path.GetFullPath(Path.Join(folderPath, filePathSpan));
}
catch (ArgumentException)
{