Make command line config file not exception if not found (#3030)

This commit is contained in:
metalgearsloth
2022-07-09 19:52:06 +10:00
committed by GitHub
parent 77b1fd933c
commit 0fb5b59eba

View File

@@ -153,26 +153,25 @@ namespace Robust.Server
if (Options.LoadConfigAndUserData)
{
string? path = _commandLineArgs?.ConfigFile;
// Sets up the configMgr
// If a config file path was passed, use it literally.
// This ensures it's working-directory relative
// (for people passing config file through the terminal or something).
// Otherwise use the one next to the executable.
if (_commandLineArgs?.ConfigFile != null)
if (string.IsNullOrEmpty(path))
{
_config.LoadFromFile(_commandLineArgs.ConfigFile);
path = PathHelpers.ExecutableRelativeFile("server_config.toml");
}
if (File.Exists(path))
{
_config.LoadFromFile(path);
}
else
{
var path = PathHelpers.ExecutableRelativeFile("server_config.toml");
if (File.Exists(path))
{
_config.LoadFromFile(path);
}
else
{
_config.SetSaveFile(path);
}
_config.SetSaveFile(path);
}
}