mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Move duplicated code into its own method
This commit is contained in:
@ -64,19 +64,8 @@ namespace osu.Game.Database
|
||||
private void copyToStore(RealmFile file, Stream data, bool preferHardLinks)
|
||||
{
|
||||
// attempt to do a fast hard link rather than copy.
|
||||
if (data is FileStream fs && preferHardLinks)
|
||||
{
|
||||
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
|
||||
{
|
||||
if (HardLinkHelper.CreateHardLink(Storage.GetFullPath(file.GetStoragePath(), true), fs.Name, IntPtr.Zero))
|
||||
return;
|
||||
}
|
||||
else if (RuntimeInfo.OS == RuntimeInfo.Platform.Linux)
|
||||
{
|
||||
if (HardLinkHelper.link(fs.Name, Storage.GetFullPath(file.GetStoragePath(), true)) == 0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (data is FileStream fs && preferHardLinks && HardLinkHelper.AttemptHardLink(Storage.GetFullPath(file.GetStoragePath(), true), fs.Name))
|
||||
return;
|
||||
|
||||
data.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
|
Reference in New Issue
Block a user