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:
parent
eb30c04c4d
commit
f3ed06cfd7
|
@ -43,7 +43,7 @@ namespace GodotTools.Core
|
||||||
path.StartsWith(DriveRoot, StringComparison.Ordinal);
|
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> { ":", "*", "?", "\"", "<", ">", "|" };
|
var invalidChars = new List<string> { ":", "*", "?", "\"", "<", ">", "|" };
|
||||||
|
|
||||||
|
|
|
@ -430,7 +430,7 @@ namespace GodotTools.Export
|
||||||
private static string DetermineDataDirNameForProject()
|
private static string DetermineDataDirNameForProject()
|
||||||
{
|
{
|
||||||
var appName = (string)ProjectSettings.GetSetting("application/config/name");
|
var appName = (string)ProjectSettings.GetSetting("application/config/name");
|
||||||
string appNameSafe = appName.ToSafeDirName(allowDirSeparator: false);
|
string appNameSafe = appName.ToSafeDirName();
|
||||||
return $"data_{appNameSafe}";
|
return $"data_{appNameSafe}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ namespace GodotTools
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var projectAssemblyName = (string)ProjectSettings.GetSetting("application/config/name");
|
var projectAssemblyName = (string)ProjectSettings.GetSetting("application/config/name");
|
||||||
|
projectAssemblyName = projectAssemblyName.ToSafeDirName();
|
||||||
if (string.IsNullOrEmpty(projectAssemblyName))
|
if (string.IsNullOrEmpty(projectAssemblyName))
|
||||||
projectAssemblyName = "UnnamedProject";
|
projectAssemblyName = "UnnamedProject";
|
||||||
return projectAssemblyName;
|
return projectAssemblyName;
|
||||||
|
|
Loading…
Reference in New Issue