(1c5ce3fee) More descriptive error messages when publishing a Workshop item fails.
This commit is contained in:
@@ -840,35 +840,20 @@ namespace Barotrauma
|
||||
{
|
||||
if (string.IsNullOrEmpty(humanConfigFile))
|
||||
{
|
||||
humanConfigFile = GetConfigFile("Human");
|
||||
humanConfigFile = GameMain.Instance.GetFilesOfType(ContentType.Character)?
|
||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == "human.xml");
|
||||
|
||||
if (humanConfigFile == null)
|
||||
{
|
||||
DebugConsole.ThrowError($"Couldn't find a human config file from the selected content packages!");
|
||||
DebugConsole.ThrowError($"(The config file must end with \"human.xml\")");
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
return characterConfigFiles;
|
||||
return humanConfigFile;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
||||
{
|
||||
string configFile = null;
|
||||
if (contentPackage == null)
|
||||
{
|
||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character, searchAllContentPackages: true)
|
||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
||||
}
|
||||
else
|
||||
{
|
||||
configFile = contentPackage.GetFilesOfType(ContentType.Character)?
|
||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
||||
}
|
||||
|
||||
if (configFile == null)
|
||||
{
|
||||
DebugConsole.ThrowError($"Couldn't find a config file for {speciesName} from the selected content packages!");
|
||||
DebugConsole.ThrowError($"(The config file must end with \"{speciesName}.xml\")");
|
||||
return string.Empty;
|
||||
}
|
||||
return configFile;
|
||||
}
|
||||
|
||||
private static IEnumerable<string> characterConfigFiles;
|
||||
private static IEnumerable<string> CharacterConfigFiles
|
||||
{
|
||||
@@ -882,12 +867,16 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Searches for a character config file from all currently selected content packages,
|
||||
/// or from a specific package if the contentPackage parameter is given.
|
||||
/// </summary>
|
||||
public static string GetConfigFile(string speciesName, ContentPackage contentPackage = null)
|
||||
{
|
||||
string configFile = null;
|
||||
if (contentPackage == null)
|
||||
{
|
||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character, searchAllContentPackages: true)
|
||||
configFile = GameMain.Instance.GetFilesOfType(ContentType.Character)
|
||||
.FirstOrDefault(c => Path.GetFileName(c).ToLowerInvariant() == $"{speciesName.ToLowerInvariant()}.xml");
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user