diff options
| author | JPVenson <github@jpb.email> | 2024-10-08 09:34:34 +0000 |
|---|---|---|
| committer | JPVenson <github@jpb.email> | 2024-10-08 09:34:34 +0000 |
| commit | d3a3d9fce3b891eb0be274a0cdc45a989e557652 (patch) | |
| tree | bd232ef477c259f1fafa204016f6efd4dcb8691f /Emby.Server.Implementations/IO/ManagedFileSystem.cs | |
| parent | ee1bdf4e222125ed7382165fd7e09599ca4bd4aa (diff) | |
| parent | aaf20592bb0bbdf4f0f0d99fed091758e68ae850 (diff) | |
Merge remote-tracking branch 'jellyfinorigin/master' into feature/EFUserData
Diffstat (limited to 'Emby.Server.Implementations/IO/ManagedFileSystem.cs')
| -rw-r--r-- | Emby.Server.Implementations/IO/ManagedFileSystem.cs | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index 28bb29df8..4b68f21d5 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -149,6 +149,26 @@ namespace Emby.Server.Implementations.IO } } + /// <inheritdoc /> + public void MoveDirectory(string source, string destination) + { + try + { + Directory.Move(source, destination); + } + catch (IOException) + { + // Cross device move requires a copy + Directory.CreateDirectory(destination); + foreach (string file in Directory.GetFiles(source)) + { + File.Copy(file, Path.Combine(destination, Path.GetFileName(file)), true); + } + + Directory.Delete(source, true); + } + } + /// <summary> /// Returns a <see cref="FileSystemMetadata"/> object for the specified file or directory path. /// </summary> @@ -327,11 +347,7 @@ namespace Emby.Server.Implementations.IO } } - /// <summary> - /// Gets the creation time UTC. - /// </summary> - /// <param name="path">The path.</param> - /// <returns>DateTime.</returns> + /// <inheritdoc /> public virtual DateTime GetCreationTimeUtc(string path) { return GetCreationTimeUtc(GetFileSystemInfo(path)); @@ -368,11 +384,7 @@ namespace Emby.Server.Implementations.IO } } - /// <summary> - /// Gets the last write time UTC. - /// </summary> - /// <param name="path">The path.</param> - /// <returns>DateTime.</returns> + /// <inheritdoc /> public virtual DateTime GetLastWriteTimeUtc(string path) { return GetLastWriteTimeUtc(GetFileSystemInfo(path)); @@ -446,11 +458,7 @@ namespace Emby.Server.Implementations.IO File.SetAttributes(path, attributes); } - /// <summary> - /// Swaps the files. - /// </summary> - /// <param name="file1">The file1.</param> - /// <param name="file2">The file2.</param> + /// <inheritdoc /> public virtual void SwapFiles(string file1, string file2) { ArgumentException.ThrowIfNullOrEmpty(file1); |
