Merge pull request #34397 from neikeq/fix-win-export-dec19-mono
Mono/C#: Fix project export and fix FindLast/GetFile regression
This commit is contained in:
commit
4bb5fbafcb
2 changed files with 22 additions and 18 deletions
|
@ -39,7 +39,7 @@ namespace GodotTools.Export
|
||||||
|
|
||||||
private void AddFile(string srcPath, string dstPath, bool remap = false)
|
private void AddFile(string srcPath, string dstPath, bool remap = false)
|
||||||
{
|
{
|
||||||
AddFile(dstPath, File.ReadAllBytes(srcPath), remap);
|
AddFile(dstPath.Replace("\\", "/"), File.ReadAllBytes(srcPath), remap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _ExportFile(string path, string type, string[] features)
|
public override void _ExportFile(string path, string type, string[] features)
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace Godot
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
int slices = 1;
|
int slices = 1;
|
||||||
|
|
||||||
while ((pos = instance.Find(splitter, true, pos)) >= 0)
|
while ((pos = instance.Find(splitter, pos, caseSensitive: true)) >= 0)
|
||||||
{
|
{
|
||||||
slices++;
|
slices++;
|
||||||
pos += splitter.Length;
|
pos += splitter.Length;
|
||||||
|
@ -229,7 +229,7 @@ namespace Godot
|
||||||
// </summary>
|
// </summary>
|
||||||
public static int CasecmpTo(this string instance, string to)
|
public static int CasecmpTo(this string instance, string to)
|
||||||
{
|
{
|
||||||
return instance.CompareTo(to, true);
|
return instance.CompareTo(to, caseSensitive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <summary>
|
// <summary>
|
||||||
|
@ -322,25 +322,29 @@ namespace Godot
|
||||||
return instance.Substring(pos + 1);
|
return instance.Substring(pos + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <summary>
|
/// <summary>Find the first occurrence of a substring. Optionally, the search starting position can be passed.</summary>
|
||||||
// Find the first occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
|
/// <returns>The starting position of the substring, or -1 if not found.</returns>
|
||||||
// </summary>
|
public static int Find(this string instance, string what, int from = 0, bool caseSensitive = true)
|
||||||
public static int Find(this string instance, string what, bool caseSensitive = true, int from = 0)
|
|
||||||
{
|
{
|
||||||
return instance.IndexOf(what, from, caseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
|
return instance.IndexOf(what, from, caseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <summary>
|
/// <summary>Find the last occurrence of a substring.</summary>
|
||||||
// Find the last occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
|
/// <returns>The starting position of the substring, or -1 if not found.</returns>
|
||||||
// </summary>
|
public static int FindLast(this string instance, string what, bool caseSensitive = true)
|
||||||
public static int FindLast(this string instance, string what, bool caseSensitive = true, int from = 0)
|
{
|
||||||
|
return instance.FindLast(what, instance.Length - 1, caseSensitive);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Find the last occurrence of a substring specifying the search starting position.</summary>
|
||||||
|
/// <returns>The starting position of the substring, or -1 if not found.</returns>
|
||||||
|
public static int FindLast(this string instance, string what, int from, bool caseSensitive = true)
|
||||||
{
|
{
|
||||||
return instance.LastIndexOf(what, from, caseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
|
return instance.LastIndexOf(what, from, caseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <summary>
|
/// <summary>Find the first occurrence of a substring but search as case-insensitive. Optionally, the search starting position can be passed.</summary>
|
||||||
// Find the first occurrence of a substring but search as case-insensitive, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
|
/// <returns>The starting position of the substring, or -1 if not found.</returns>
|
||||||
// </summary>
|
|
||||||
public static int FindN(this string instance, string what, int from = 0)
|
public static int FindN(this string instance, string what, int from = 0)
|
||||||
{
|
{
|
||||||
return instance.IndexOf(what, from, StringComparison.OrdinalIgnoreCase);
|
return instance.IndexOf(what, from, StringComparison.OrdinalIgnoreCase);
|
||||||
|
@ -502,7 +506,7 @@ namespace Godot
|
||||||
// </summary>
|
// </summary>
|
||||||
public static bool IsSubsequenceOfI(this string instance, string text)
|
public static bool IsSubsequenceOfI(this string instance, string text)
|
||||||
{
|
{
|
||||||
return instance.IsSubsequenceOf(text, false);
|
return instance.IsSubsequenceOf(text, caseSensitive: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <summary>
|
// <summary>
|
||||||
|
@ -662,7 +666,7 @@ namespace Godot
|
||||||
// </summary>
|
// </summary>
|
||||||
public static bool MatchN(this string instance, string expr)
|
public static bool MatchN(this string instance, string expr)
|
||||||
{
|
{
|
||||||
return instance.ExprMatch(expr, false);
|
return instance.ExprMatch(expr, caseSensitive: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <summary>
|
// <summary>
|
||||||
|
@ -692,7 +696,7 @@ namespace Godot
|
||||||
// </summary>
|
// </summary>
|
||||||
public static int NocasecmpTo(this string instance, string to)
|
public static int NocasecmpTo(this string instance, string to)
|
||||||
{
|
{
|
||||||
return instance.CompareTo(to, false);
|
return instance.CompareTo(to, caseSensitive: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <summary>
|
// <summary>
|
||||||
|
@ -928,7 +932,7 @@ namespace Godot
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
int end = instance.Find(divisor, true, from);
|
int end = instance.Find(divisor, from, caseSensitive: true);
|
||||||
if (end < 0)
|
if (end < 0)
|
||||||
end = len;
|
end = len;
|
||||||
if (allowEmpty || end > from)
|
if (allowEmpty || end > from)
|
||||||
|
|
Loading…
Reference in a new issue