diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-01-24 01:14:24 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-24 01:14:24 -0500 |
| commit | d4e267a62d949905cf91a0d74b80566a8a2957a6 (patch) | |
| tree | 719702f0c9bde0c0eb899a0b4539eae6126192b1 /Emby.Common.Implementations/IO/ManagedFileSystem.cs | |
| parent | 7abbdfb7680bb0d81c5a334df2284122cac48891 (diff) | |
| parent | 2ebcbdece8ad941e3a4d95000c1071c1e1ad81ab (diff) | |
Merge pull request #2414 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Common.Implementations/IO/ManagedFileSystem.cs')
| -rw-r--r-- | Emby.Common.Implementations/IO/ManagedFileSystem.cs | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/Emby.Common.Implementations/IO/ManagedFileSystem.cs b/Emby.Common.Implementations/IO/ManagedFileSystem.cs index 72b9d55eb..3fe20f659 100644 --- a/Emby.Common.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Common.Implementations/IO/ManagedFileSystem.cs @@ -20,10 +20,13 @@ namespace Emby.Common.Implementations.IO private readonly List<IShortcutHandler> _shortcutHandlers = new List<IShortcutHandler>(); private bool EnableFileSystemRequestConcat = true; - public ManagedFileSystem(ILogger logger, bool supportsAsyncFileStreams, bool enableManagedInvalidFileNameChars, bool enableFileSystemRequestConcat) + private string _tempPath; + + public ManagedFileSystem(ILogger logger, bool supportsAsyncFileStreams, bool enableManagedInvalidFileNameChars, bool enableFileSystemRequestConcat, string tempPath) { Logger = logger; _supportsAsyncFileStreams = supportsAsyncFileStreams; + _tempPath = tempPath; EnableFileSystemRequestConcat = enableFileSystemRequestConcat; SetInvalidFileNameChars(enableManagedInvalidFileNameChars); } @@ -487,12 +490,13 @@ namespace Emby.Common.Implementations.IO throw new ArgumentNullException("file2"); } - var temp1 = Path.GetTempFileName(); + var temp1 = Path.Combine(_tempPath, Guid.NewGuid().ToString("N")); // Copying over will fail against hidden files SetHidden(file1, false); SetHidden(file2, false); + Directory.CreateDirectory(_tempPath); CopyFile(file1, temp1, true); CopyFile(file2, file1, true); @@ -674,21 +678,7 @@ namespace Emby.Common.Implementations.IO private IEnumerable<FileSystemMetadata> ToMetadata(string parentPath, IEnumerable<FileSystemInfo> infos) { - return infos.Select(i => - { - try - { - return GetFileSystemMetadata(i); - } - catch (PathTooLongException) - { - // Can't log using the FullName because it will throw the PathTooLongExceptiona again - //Logger.Warn("Path too long: {0}", i.FullName); - Logger.Warn("File or directory path too long. Parent folder: {0}", parentPath); - return null; - } - - }).Where(i => i != null); + return infos.Select(GetFileSystemMetadata); } public string[] ReadAllLines(string path) |
