mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
update SwapFiles
This commit is contained in:
parent
8999198cca
commit
c53ab214c7
1 changed files with 2 additions and 27 deletions
|
@ -490,38 +490,13 @@ namespace Emby.Common.Implementations.IO
|
||||||
var temp1 = Path.GetTempFileName();
|
var temp1 = Path.GetTempFileName();
|
||||||
|
|
||||||
// Copying over will fail against hidden files
|
// Copying over will fail against hidden files
|
||||||
RemoveHiddenAttribute(file1);
|
SetHidden(file1, false);
|
||||||
RemoveHiddenAttribute(file2);
|
SetHidden(file2, false);
|
||||||
|
|
||||||
CopyFile(file1, temp1, true);
|
CopyFile(file1, temp1, true);
|
||||||
|
|
||||||
CopyFile(file2, file1, true);
|
CopyFile(file2, file1, true);
|
||||||
CopyFile(temp1, file2, true);
|
CopyFile(temp1, file2, true);
|
||||||
|
|
||||||
DeleteFile(temp1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Removes the hidden attribute.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="path">The path.</param>
|
|
||||||
private void RemoveHiddenAttribute(string path)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(path))
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("path");
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentFile = new FileInfo(path);
|
|
||||||
|
|
||||||
// This will fail if the file is hidden
|
|
||||||
if (currentFile.Exists)
|
|
||||||
{
|
|
||||||
if ((currentFile.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
|
|
||||||
{
|
|
||||||
currentFile.Attributes &= ~FileAttributes.Hidden;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ContainsSubPath(string parentPath, string path)
|
public bool ContainsSubPath(string parentPath, string path)
|
||||||
|
|
Loading…
Reference in a new issue