diff --git a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs index a26782690..d92be993e 100644 --- a/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs +++ b/Barotrauma/BarotraumaClient/Source/Screens/SubEditorScreen.cs @@ -378,12 +378,15 @@ namespace Barotrauma nameBox.Flash(); return false; } - - if (nameBox.Text.Contains("../")) + + foreach (char illegalChar in Path.GetInvalidFileNameChars()) { - DebugConsole.ThrowError("Illegal symbols in filename (../)"); - nameBox.Flash(); - return false; + if (nameBox.Text.Contains(illegalChar)) + { + GUI.AddMessage(TextManager.Get("SubNameIllegalCharsWarning").Replace("[illegalchar]", illegalChar.ToString()), Color.Red, 3.0f); + nameBox.Flash(); + return false; + } } string savePath = nameBox.Text + ".sub"; diff --git a/Barotrauma/BarotraumaShared/Content/Texts.xml b/Barotrauma/BarotraumaShared/Content/Texts.xml index 718861ee7..c1140f639 100644 --- a/Barotrauma/BarotraumaShared/Content/Texts.xml +++ b/Barotrauma/BarotraumaShared/Content/Texts.xml @@ -226,6 +226,7 @@ Gaps Previously used Name your submarine before saving it. + Illegal symbols in filename ([illegalchar]) Submarine saved to [filepath]. Save submarine Name