mirror of
https://github.com/ppy/osu
synced 2025-03-11 05:49:12 +00:00
Use switch statement in AttemptHardLink()
This commit is contained in:
parent
2c346eae0d
commit
cadd487c75
@ -56,14 +56,17 @@ namespace osu.Game.IO
|
||||
|
||||
public static bool AttemptHardLink(string testDestinationPath, string testSourcePath)
|
||||
{
|
||||
bool isHardLinkAvailable = false;
|
||||
switch (RuntimeInfo.OS)
|
||||
{
|
||||
case RuntimeInfo.Platform.Windows:
|
||||
return CreateHardLink(testDestinationPath, testSourcePath, IntPtr.Zero);
|
||||
|
||||
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
|
||||
isHardLinkAvailable = CreateHardLink(testDestinationPath, testSourcePath, IntPtr.Zero);
|
||||
else if (RuntimeInfo.OS == RuntimeInfo.Platform.Linux)
|
||||
isHardLinkAvailable = link(testSourcePath, testDestinationPath) == 0;
|
||||
case RuntimeInfo.Platform.Linux:
|
||||
return link(testSourcePath, testDestinationPath) == 0;
|
||||
|
||||
return isHardLinkAvailable;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// For future use (to detect if a file is a hard link with other references existing on disk).
|
||||
|
Loading…
Reference in New Issue
Block a user