diff options
| author | Bond_009 <bond.009@outlook.com> | 2023-10-06 00:40:09 +0200 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2023-10-06 01:04:25 +0200 |
| commit | b176beb88e22a36cc056439ac2a4df4fbe68f2c1 (patch) | |
| tree | 46988cc14ba7e8bdd9d6eb89588b1472f6caa25d /Emby.Server.Implementations/IO | |
| parent | 40f7eb4e8cd9e250fb3870a4799a5a8d949e2068 (diff) | |
Reduce string allocations
Some simple changes to reduce the number of allocated strings
Diffstat (limited to 'Emby.Server.Implementations/IO')
| -rw-r--r-- | Emby.Server.Implementations/IO/ManagedFileSystem.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index 18b00ce0b..4178936ce 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -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) { |
