Fix file not found exceptions when starting up the game with a debugger (#1562)

* Fix exceptions when starting up the game

* Remove try catches
This commit is contained in:
DrSmugleaf
2021-02-16 20:05:22 +01:00
committed by GitHub
parent 17182dd0e8
commit a40c4a435c
2 changed files with 19 additions and 19 deletions

View File

@@ -152,21 +152,21 @@ namespace Robust.Server.ServerStatus
private void RegisterCVars()
{
try
var path = PathHelpers.ExecutableRelativeFile("build.json");
if (!File.Exists(path))
{
var buildInfo = File.ReadAllText(PathHelpers.ExecutableRelativeFile("build.json"));
var info = JsonConvert.DeserializeObject<BuildInfo>(buildInfo);
return;
}
// Don't replace cvars with contents of build.json if overriden by --cvar or such.
SetCVarIfUnmodified(CVars.BuildEngineVersion, info.EngineVersion);
SetCVarIfUnmodified(CVars.BuildForkId, info.ForkId);
SetCVarIfUnmodified(CVars.BuildVersion, info.Version);
SetCVarIfUnmodified(CVars.BuildDownloadUrl, info.Download ?? "");
SetCVarIfUnmodified(CVars.BuildHash, info.Hash ?? "");
}
catch (FileNotFoundException)
{
}
var buildInfo = File.ReadAllText(path);
var info = JsonConvert.DeserializeObject<BuildInfo>(buildInfo);
// Don't replace cvars with contents of build.json if overriden by --cvar or such.
SetCVarIfUnmodified(CVars.BuildEngineVersion, info.EngineVersion);
SetCVarIfUnmodified(CVars.BuildForkId, info.ForkId);
SetCVarIfUnmodified(CVars.BuildVersion, info.Version);
SetCVarIfUnmodified(CVars.BuildDownloadUrl, info.Download ?? "");
SetCVarIfUnmodified(CVars.BuildHash, info.Hash ?? "");
void SetCVarIfUnmodified(CVarDef<string> cvar, string val)
{

View File

@@ -767,14 +767,14 @@ namespace Robust.Shared.ContentPack
var dllName = $"{simpleName}.dll";
foreach (var diskLoadPath in _diskLoadPaths)
{
try
{
var path = Path.Combine(diskLoadPath, dllName);
return new PEReader(File.OpenRead(path));
}
catch (FileNotFoundException)
var path = Path.Combine(diskLoadPath, dllName);
if (!File.Exists(path))
{
continue;
}
return new PEReader(File.OpenRead(path));
}
var extraStream = _parent.ExtraRobustLoader?.Invoke(dllName);