mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 01:17:35 +09:00
Streamline autodetect & manual set path
This commit is contained in:
parent
992aa0041e
commit
34cd9f7a69
@ -162,7 +162,7 @@ namespace osu.Game.Tournament.IPC
|
|||||||
|
|
||||||
public bool SetIPCLocation(string path)
|
public bool SetIPCLocation(string path)
|
||||||
{
|
{
|
||||||
if (!ipcFileExistsInDirectory(path))
|
if (path == null || !ipcFileExistsInDirectory(path))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var newStorage = initialiseIPCStorage(stableInfo.StablePath = path);
|
var newStorage = initialiseIPCStorage(stableInfo.StablePath = path);
|
||||||
@ -173,22 +173,11 @@ namespace osu.Game.Tournament.IPC
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AutoDetectIPCLocation()
|
public bool AutoDetectIPCLocation() => SetIPCLocation(findStablePath());
|
||||||
{
|
|
||||||
var autoDetectedPath = findStablePath();
|
|
||||||
if (string.IsNullOrEmpty(autoDetectedPath))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
var newStorage = initialiseIPCStorage(stableInfo.StablePath = autoDetectedPath);
|
|
||||||
if (newStorage == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
stableInfo.SaveChanges();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool ipcFileExistsInDirectory(string p) => File.Exists(Path.Combine(p, "ipc.txt"));
|
private static bool ipcFileExistsInDirectory(string p) => File.Exists(Path.Combine(p, "ipc.txt"));
|
||||||
|
|
||||||
|
[CanBeNull]
|
||||||
private string findStablePath()
|
private string findStablePath()
|
||||||
{
|
{
|
||||||
string stableInstallPath = string.Empty;
|
string stableInstallPath = string.Empty;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user