mirror of
https://github.com/osukey/osukey.git
synced 2025-06-30 07:38:04 +09:00
invert if-statement and early return + reuse of checkExists
This commit is contained in:
parent
15ebe38303
commit
b1c957c5e1
@ -157,7 +157,7 @@ namespace osu.Game.Tournament.IPC
|
|||||||
return IPCStorage;
|
return IPCStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool checkExists(string p) => File.Exists(Path.Combine(p, "ipc.txt"));
|
public bool checkExists(string p) => File.Exists(Path.Combine(p, "ipc.txt"));
|
||||||
|
|
||||||
private string findStablePath()
|
private string findStablePath()
|
||||||
{
|
{
|
||||||
|
@ -140,10 +140,19 @@ namespace osu.Game.Tournament.Screens
|
|||||||
private void changePath(Storage storage)
|
private void changePath(Storage storage)
|
||||||
{
|
{
|
||||||
var target = directorySelector.CurrentDirectory.Value.FullName;
|
var target = directorySelector.CurrentDirectory.Value.FullName;
|
||||||
|
var fileBasedIpc = ipc as FileBasedIPC;
|
||||||
Logger.Log($"Changing Stable CE location to {target}");
|
Logger.Log($"Changing Stable CE location to {target}");
|
||||||
|
|
||||||
if (File.Exists(Path.Combine(target, "ipc.txt")))
|
if (!fileBasedIpc.checkExists(target))
|
||||||
{
|
{
|
||||||
|
overlay = new DialogOverlay();
|
||||||
|
overlay.Push(new IPCErrorDialog("This is an invalid IPC Directory", "Select a directory that contains an osu! stable cutting edge installation and make sure it has an empty ipc.txt file in it."));
|
||||||
|
AddInternal(overlay);
|
||||||
|
Logger.Log("Folder is not an osu! stable CE directory");
|
||||||
|
return;
|
||||||
|
// Return an error in the picker that the directory does not contain ipc.txt
|
||||||
|
}
|
||||||
|
|
||||||
stableInfo.StablePath.Value = target;
|
stableInfo.StablePath.Value = target;
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -160,7 +169,7 @@ namespace osu.Game.Tournament.Screens
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileBasedIpc = ipc as FileBasedIPC;
|
|
||||||
fileBasedIpc?.LocateStableStorage();
|
fileBasedIpc?.LocateStableStorage();
|
||||||
sceneManager?.SetScreen(typeof(SetupScreen));
|
sceneManager?.SetScreen(typeof(SetupScreen));
|
||||||
}
|
}
|
||||||
@ -169,15 +178,6 @@ namespace osu.Game.Tournament.Screens
|
|||||||
Logger.Log($"Error during migration: {e.Message}", level: LogLevel.Error);
|
Logger.Log($"Error during migration: {e.Message}", level: LogLevel.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
overlay = new DialogOverlay();
|
|
||||||
overlay.Push(new IPCErrorDialog("This is an invalid IPC Directory", "Select a directory that contains an osu! stable cutting edge installation and make sure it has an empty ipc.txt file in it."));
|
|
||||||
AddInternal(overlay);
|
|
||||||
Logger.Log("Folder is not an osu! stable CE directory");
|
|
||||||
// Return an error in the picker that the directory does not contain ipc.txt
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void autoDetect()
|
private void autoDetect()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user