Mono/C#: Fix editor using wrong project assembly path in rare cases

We were removing invalid path characters from the
name in C++ code, but the C# editor code wasn't.

(cherry picked from commit 8bb48ae57a)
This commit is contained in:
Ignacio Etcheverry 2020-08-20 22:34:57 +02:00 committed by Rémi Verschelde
parent eb30c04c4d
commit f3ed06cfd7
No known key found for this signature in database
GPG Key ID: C3336907360768E1
3 changed files with 3 additions and 2 deletions

View File

@ -43,7 +43,7 @@ namespace GodotTools.Core
path.StartsWith(DriveRoot, StringComparison.Ordinal);
}
public static string ToSafeDirName(this string dirName, bool allowDirSeparator)
public static string ToSafeDirName(this string dirName, bool allowDirSeparator = false)
{
var invalidChars = new List<string> { ":", "*", "?", "\"", "<", ">", "|" };

View File

@ -430,7 +430,7 @@ namespace GodotTools.Export
private static string DetermineDataDirNameForProject()
{
var appName = (string)ProjectSettings.GetSetting("application/config/name");
string appNameSafe = appName.ToSafeDirName(allowDirSeparator: false);
string appNameSafe = appName.ToSafeDirName();
return $"data_{appNameSafe}";
}

View File

@ -45,6 +45,7 @@ namespace GodotTools
get
{
var projectAssemblyName = (string)ProjectSettings.GetSetting("application/config/name");
projectAssemblyName = projectAssemblyName.ToSafeDirName();
if (string.IsNullOrEmpty(projectAssemblyName))
projectAssemblyName = "UnnamedProject";
return projectAssemblyName;