Browse Source

Handle exception if `git` is not found

pull/1915/head
duckdoom5 4 months ago
parent
commit
307f720ef5
  1. 9
      src/Generator/Utils/Utils.cs

9
src/Generator/Utils/Utils.cs

@ -84,7 +84,7 @@ namespace CppSharp
{ {
while (stringBuilder.Length > 0 && stringBuilder[0] == '_') while (stringBuilder.Length > 0 && stringBuilder[0] == '_')
stringBuilder.Remove(0, 1); stringBuilder.Remove(0, 1);
while (stringBuilder.Length > 0 && stringBuilder[stringBuilder.Length - 1] == '_') while (stringBuilder.Length > 0 && stringBuilder[^1] == '_')
stringBuilder.Remove(stringBuilder.Length - 1, 1); stringBuilder.Remove(stringBuilder.Length - 1, 1);
} }
} }
@ -135,6 +135,8 @@ namespace CppSharp
public static class GeneratorHelpers public static class GeneratorHelpers
{ {
public static NewLineType? GetNewLineTypeFromGitConfig(string outputDir) public static NewLineType? GetNewLineTypeFromGitConfig(string outputDir)
{
try
{ {
if (!bool.TryParse( if (!bool.TryParse(
ProcessHelper.RunFrom(outputDir, ProcessHelper.RunFrom(outputDir,
@ -178,5 +180,10 @@ namespace CppSharp
_ => null _ => null
}; };
} }
catch (Exception)
{
return null;
}
}
} }
} }

Loading…
Cancel
Save