diff options
Diffstat (limited to 'modules/mono/editor/GodotTools')
26 files changed, 201 insertions, 187 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs b/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs index 2bf1cb7a18..01aa65bfc3 100644 --- a/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs +++ b/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotBuildLogger.cs @@ -7,8 +7,6 @@ namespace GodotTools.BuildLogger { public class GodotBuildLogger : ILogger { - public static readonly string AssemblyPath = Path.GetFullPath(typeof(GodotBuildLogger).Assembly.Location); - public string Parameters { get; set; } public LoggerVerbosity Verbosity { get; set; } diff --git a/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotTools.BuildLogger.csproj b/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotTools.BuildLogger.csproj index 0afec970c6..9e36497b06 100644 --- a/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotTools.BuildLogger.csproj +++ b/modules/mono/editor/GodotTools/GodotTools.BuildLogger/GodotTools.BuildLogger.csproj @@ -5,6 +5,6 @@ <LangVersion>7.2</LangVersion> </PropertyGroup> <ItemGroup> - <PackageReference Include="Microsoft.Build.Framework" Version="16.5.0" /> + <PackageReference Include="Microsoft.Build.Framework" Version="15.1.548" ExcludeAssets="runtime" /> </ItemGroup> </Project> diff --git a/modules/mono/editor/GodotTools/GodotTools.Core/GodotTools.Core.csproj b/modules/mono/editor/GodotTools/GodotTools.Core/GodotTools.Core.csproj index d6d8962f90..caf0b9c7bb 100644 --- a/modules/mono/editor/GodotTools/GodotTools.Core/GodotTools.Core.csproj +++ b/modules/mono/editor/GodotTools/GodotTools.Core/GodotTools.Core.csproj @@ -1,7 +1,7 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <ProjectGuid>{639E48BD-44E5-4091-8EDD-22D36DC0768D}</ProjectGuid> - <TargetFramework>netstandard2.0</TargetFramework> + <TargetFramework>net5.0</TargetFramework> <LangVersion>7.2</LangVersion> </PropertyGroup> </Project> diff --git a/modules/mono/editor/GodotTools/GodotTools.IdeMessaging.CLI/GodotTools.IdeMessaging.CLI.csproj b/modules/mono/editor/GodotTools/GodotTools.IdeMessaging.CLI/GodotTools.IdeMessaging.CLI.csproj index 303ca3a293..d2132115f3 100644 --- a/modules/mono/editor/GodotTools/GodotTools.IdeMessaging.CLI/GodotTools.IdeMessaging.CLI.csproj +++ b/modules/mono/editor/GodotTools/GodotTools.IdeMessaging.CLI/GodotTools.IdeMessaging.CLI.csproj @@ -1,4 +1,4 @@ -<Project Sdk="Microsoft.NET.Sdk"> +<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <ProjectGuid>{B06C2951-C8E3-4F28-80B2-717CF327EB19}</ProjectGuid> <OutputType>Exe</OutputType> diff --git a/modules/mono/editor/GodotTools/GodotTools.OpenVisualStudio/GodotTools.OpenVisualStudio.csproj b/modules/mono/editor/GodotTools/GodotTools.OpenVisualStudio/GodotTools.OpenVisualStudio.csproj index 5b3ed0b1b7..c05096bdcc 100644 --- a/modules/mono/editor/GodotTools/GodotTools.OpenVisualStudio/GodotTools.OpenVisualStudio.csproj +++ b/modules/mono/editor/GodotTools/GodotTools.OpenVisualStudio/GodotTools.OpenVisualStudio.csproj @@ -1,4 +1,4 @@ -<Project Sdk="Microsoft.NET.Sdk"> +<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <ProjectGuid>{EAFFF236-FA96-4A4D-BD23-0E51EF988277}</ProjectGuid> <OutputType>Exe</OutputType> diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj index 37123ba2b2..dff40fb846 100644 --- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj +++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/GodotTools.ProjectEditor.csproj @@ -1,32 +1,16 @@ -<Project Sdk="Microsoft.NET.Sdk"> +<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <ProjectGuid>{A8CDAD94-C6D4-4B19-A7E7-76C53CC92984}</ProjectGuid> - <TargetFramework>net472</TargetFramework> + <TargetFramework>net5.0</TargetFramework> <LangVersion>7.2</LangVersion> </PropertyGroup> <ItemGroup> - <PackageReference Include="Microsoft.Build" Version="16.5.0" /> + <PackageReference Include="Microsoft.Build" Version="15.1.548" ExcludeAssets="runtime" /> + <PackageReference Include="Microsoft.Build.Locator" Version="1.2.6" /> <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\GodotTools.Core\GodotTools.Core.csproj" /> <ProjectReference Include="..\GodotTools.Shared\GodotTools.Shared.csproj" /> </ItemGroup> - <!-- - The Microsoft.Build.Runtime package is too problematic so we create a MSBuild.exe stub. The workaround described - here doesn't work with Microsoft.NETFramework.ReferenceAssemblies: https://github.com/microsoft/msbuild/issues/3486 - We need a MSBuild.exe file as there's an issue in Microsoft.Build where it executes platform dependent code when - searching for MSBuild.exe before the fallback to not using it. A stub is fine as it should never be executed. - --> - <ItemGroup> - <None Include="MSBuild.exe" CopyToOutputDirectory="Always" /> - </ItemGroup> - <Target Name="CopyMSBuildStubWindows" AfterTargets="Build" Condition=" '$(GodotPlatform)' == 'windows' Or ( '$(GodotPlatform)' == '' And '$(OS)' == 'Windows_NT' ) "> - <PropertyGroup> - <GodotSourceRootPath>$(SolutionDir)/../../../../</GodotSourceRootPath> - <GodotOutputDataDir>$(GodotSourceRootPath)/bin/GodotSharp</GodotOutputDataDir> - </PropertyGroup> - <!-- Need to copy it here as well on Windows --> - <Copy SourceFiles="MSBuild.exe" DestinationFiles="$(GodotOutputDataDir)\Mono\lib\mono\v4.0\MSBuild.exe" /> - </Target> </Project> diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/MSBuild.exe b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/MSBuild.exe deleted file mode 100644 index e69de29bb2..0000000000 --- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/MSBuild.exe +++ /dev/null diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs index 7d49d251dd..c549cf5f12 100644 --- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs +++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectGenerator.cs @@ -21,7 +21,8 @@ namespace GodotTools.ProjectEditor root.Sdk = GodotSdkAttrValue; var mainGroup = root.AddPropertyGroup(); - mainGroup.AddProperty("TargetFramework", "netstandard2.1"); + mainGroup.AddProperty("TargetFramework", "net5.0"); + mainGroup.AddProperty("EnableDynamicLoading", "true"); string sanitizedName = IdentifierUtils.SanitizeQualifiedIdentifier(name, allowEmptyIdentifiers: true); diff --git a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs index cdac9acb25..9b921c517c 100644 --- a/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs +++ b/modules/mono/editor/GodotTools/GodotTools.ProjectEditor/ProjectUtils.cs @@ -19,6 +19,9 @@ namespace GodotTools.ProjectEditor public static class ProjectUtils { + public static void MSBuildLocatorRegisterDefaults() + => Microsoft.Build.Locator.MSBuildLocator.RegisterDefaults(); + public static MSBuildProject Open(string path) { var root = ProjectRootElement.Open(path); @@ -42,7 +45,8 @@ namespace GodotTools.ProjectEditor var root = project.Root; string godotSdkAttrValue = ProjectGenerator.GodotSdkAttrValue; - if (!string.IsNullOrEmpty(root.Sdk) && root.Sdk.Trim().Equals(godotSdkAttrValue, StringComparison.OrdinalIgnoreCase)) + if (!string.IsNullOrEmpty(root.Sdk) && + root.Sdk.Trim().Equals(godotSdkAttrValue, StringComparison.OrdinalIgnoreCase)) return; root.Sdk = godotSdkAttrValue; diff --git a/modules/mono/editor/GodotTools/GodotTools.Shared/GodotTools.Shared.csproj b/modules/mono/editor/GodotTools/GodotTools.Shared/GodotTools.Shared.csproj index 3bc1698c15..4b058a5daa 100644 --- a/modules/mono/editor/GodotTools/GodotTools.Shared/GodotTools.Shared.csproj +++ b/modules/mono/editor/GodotTools/GodotTools.Shared/GodotTools.Shared.csproj @@ -1,6 +1,6 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> - <TargetFramework>netstandard2.0</TargetFramework> + <TargetFramework>net5.0</TargetFramework> </PropertyGroup> <Import Project="GenerateGodotNupkgsVersions.targets" /> </Project> diff --git a/modules/mono/editor/GodotTools/GodotTools.sln b/modules/mono/editor/GodotTools/GodotTools.sln index d3107a69db..415e49b426 100644 --- a/modules/mono/editor/GodotTools/GodotTools.sln +++ b/modules/mono/editor/GodotTools/GodotTools.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2012 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GodotTools.ProjectEditor", "GodotTools.ProjectEditor\GodotTools.ProjectEditor.csproj", "{A8CDAD94-C6D4-4B19-A7E7-76C53CC92984}" diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs index 33967ffa71..58677625c6 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs @@ -1,9 +1,9 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Threading.Tasks; using GodotTools.Ides.Rider; using GodotTools.Internals; -using JetBrains.Annotations; using static GodotTools.Internals.Globals; using File = GodotTools.Utils.File; using OS = GodotTools.Utils.OS; @@ -159,7 +159,7 @@ namespace GodotTools.Build } } - public static bool BuildProjectBlocking(string config, [CanBeNull] string[] targets = null, [CanBeNull] string platform = null) + public static bool BuildProjectBlocking(string config, [MaybeNull] string[] targets = null, [MaybeNull] string platform = null) { var buildInfo = new BuildInfo(GodotSharpDirs.ProjectSlnPath, targets ?? new[] {"Build"}, config, restore: true); diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs index ebdaca0ce8..ed5ee10585 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildOutputView.cs @@ -1,8 +1,8 @@ using Godot; using System; +using System.Diagnostics.CodeAnalysis; using Godot.Collections; using GodotTools.Internals; -using JetBrains.Annotations; using File = GodotTools.Utils.File; using Path = System.IO.Path; diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs index 02e9d98647..0e793a44ba 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs @@ -127,7 +127,7 @@ namespace GodotTools.Build arguments += $@" /t:{string.Join(",", buildInfo.Targets)} " + $@"""/p:{"Configuration=" + buildInfo.Configuration}"" /v:normal " + - $@"""/l:{typeof(GodotBuildLogger).FullName},{GodotBuildLogger.AssemblyPath};{buildInfo.LogsDirPath}"""; + $@"""{AddLoggerArgument(buildInfo)}"""; foreach (string customProperty in buildInfo.CustomProperties) { @@ -137,6 +137,14 @@ namespace GodotTools.Build return arguments; } + private static string AddLoggerArgument(BuildInfo buildInfo) + { + string buildLoggerPath = Path.Combine(GodotSharpDirs.DataEditorToolsDir, + "GodotTools.BuildLogger.dll"); + + return $"/l:{typeof(GodotBuildLogger).FullName},{buildLoggerPath};{buildInfo.LogsDirPath}"; + } + private static void RemovePlatformVariable(StringDictionary environmentVariables) { // EnvironmentVariables is case sensitive? Seriously? diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs b/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs index 3c020a2589..13b3ab7da2 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/MSBuildPanel.cs @@ -1,7 +1,6 @@ using System; using Godot; using GodotTools.Internals; -using JetBrains.Annotations; using static GodotTools.Internals.Globals; using File = GodotTools.Utils.File; @@ -28,7 +27,6 @@ namespace GodotTools.Build BuildOutputView.UpdateIssuesList(); } - [UsedImplicitly] public void BuildSolution() { if (!File.Exists(GodotSharpDirs.ProjectSlnPath)) @@ -57,7 +55,6 @@ namespace GodotTools.Build Internal.ReloadAssemblies(softReload: false); } - [UsedImplicitly] private void RebuildSolution() { if (!File.Exists(GodotSharpDirs.ProjectSlnPath)) @@ -86,7 +83,6 @@ namespace GodotTools.Build Internal.ReloadAssemblies(softReload: false); } - [UsedImplicitly] private void CleanSolution() { if (!File.Exists(GodotSharpDirs.ProjectSlnPath)) diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs index ee3f5999cd..25c2e4ab59 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs @@ -3,13 +3,13 @@ using Godot.NativeInterop; using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Runtime.CompilerServices; using GodotTools.Build; using GodotTools.Core; using GodotTools.Internals; -using JetBrains.Annotations; using static GodotTools.Internals.Globals; using Directory = GodotTools.Utils.Directory; using File = GodotTools.Utils.File; @@ -238,8 +238,9 @@ namespace GodotTools.Export using godot_string buildConfigAux = Marshaling.mono_string_to_godot(buildConfig); using godot_string bclDirAux = Marshaling.mono_string_to_godot(bclDir); godot_dictionary assembliesAux = ((Godot.Collections.Dictionary)assemblies).NativeValue; - internal_GetExportedAssemblyDependencies(initialAssembliesAux, buildConfigAux, bclDirAux, - ref assembliesAux); + // TODO + throw new NotImplementedException(); + //internal_GetExportedAssemblyDependencies(initialAssembliesAux, buildConfigAux, bclDirAux, ref assembliesAux); AddI18NAssemblies(assemblies, bclDir); @@ -349,7 +350,7 @@ namespace GodotTools.Export } } - [NotNull] + [return: NotNull] private static string ExportDataDirectory(string[] features, string platform, bool isDebug, string outputDir) { string target = isDebug ? "release_debug" : "release"; @@ -498,10 +499,5 @@ namespace GodotTools.Export string appNameSafe = appName.ToSafeDirName(); return $"data_{appNameSafe}"; } - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_GetExportedAssemblyDependencies( - in godot_dictionary initialAssemblies, in godot_string buildConfig, - in godot_string customBclDir, ref godot_dictionary dependencyAssemblies); } } diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs index 5167333716..2d85513766 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs +++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs @@ -51,6 +51,7 @@ namespace GodotTools } } + [UsedImplicitly] private bool CreateProjectSolution() { using (var pr = new EditorProgress("create_csharp_solution", "Generating solution...".TTR(), 2)) @@ -75,7 +76,7 @@ namespace GodotTools { Guid = guid, PathRelativeToSolution = name + ".csproj", - Configs = new List<string> {"Debug", "ExportDebug", "ExportRelease"} + Configs = new List<string> { "Debug", "ExportDebug", "ExportRelease" } }; solution.AddNewProject(name, projectInfo); @@ -123,7 +124,8 @@ namespace GodotTools try { string fallbackFolder = NuGetUtils.GodotFallbackFolderPath; - NuGetUtils.AddFallbackFolderToUserNuGetConfigs(NuGetUtils.GodotFallbackFolderName, fallbackFolder); + NuGetUtils.AddFallbackFolderToUserNuGetConfigs(NuGetUtils.GodotFallbackFolderName, + fallbackFolder); NuGetUtils.AddBundledPackagesToFallbackFolder(fallbackFolder); } catch (Exception e) @@ -201,13 +203,15 @@ namespace GodotTools try { if (Godot.OS.IsStdoutVerbose()) - Console.WriteLine($"Running: \"{command}\" {string.Join(" ", args.Select(a => $"\"{a}\""))}"); + Console.WriteLine( + $"Running: \"{command}\" {string.Join(" ", args.Select(a => $"\"{a}\""))}"); OS.RunProcess(command, args); } catch (Exception e) { - GD.PushError($"Error when trying to run code editor: VisualStudio. Exception message: '{e.Message}'"); + GD.PushError( + $"Error when trying to run code editor: VisualStudio. Exception message: '{e.Message}'"); } break; @@ -378,6 +382,8 @@ namespace GodotTools { base._EnablePlugin(); + ProjectUtils.MSBuildLocatorRegisterDefaults(); + if (Instance != null) throw new InvalidOperationException(); Instance = this; @@ -393,7 +399,7 @@ namespace GodotTools MSBuildPanel = new MSBuildPanel(); _bottomPanelBtn = AddControlToBottomPanel(MSBuildPanel, "MSBuild".TTR()); - AddChild(new HotReloadAssemblyWatcher {Name = "HotReloadAssemblyWatcher"}); + AddChild(new HotReloadAssemblyWatcher { Name = "HotReloadAssemblyWatcher" }); _menuPopup = new PopupMenu(); _menuPopup.Hide(); @@ -469,7 +475,8 @@ namespace GodotTools try { // At startup we make sure NuGet.Config files have our Godot NuGet fallback folder included - NuGetUtils.AddFallbackFolderToUserNuGetConfigs(NuGetUtils.GodotFallbackFolderName, NuGetUtils.GodotFallbackFolderPath); + NuGetUtils.AddFallbackFolderToUserNuGetConfigs(NuGetUtils.GodotFallbackFolderName, + NuGetUtils.GodotFallbackFolderPath); } catch (Exception e) { diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj index d44cd75155..d0fae02d5d 100644 --- a/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj +++ b/modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj @@ -1,7 +1,8 @@ <Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <ProjectGuid>{27B00618-A6F2-4828-B922-05CAEB08C286}</ProjectGuid> - <TargetFramework>net472</TargetFramework> + <TargetFramework>net5.0</TargetFramework> + <EnableDynamicLoading>true</EnableDynamicLoading> <LangVersion>8</LangVersion> <!-- The Godot editor uses the Debug Godot API assemblies --> <GodotApiConfiguration>Debug</GodotApiConfiguration> @@ -21,6 +22,8 @@ <PackageReference Include="JetBrains.Annotations" Version="2019.1.3.0" ExcludeAssets="runtime" PrivateAssets="all" /> <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> + <!-- For RiderPathLocator --> + <PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" /> <Reference Include="GodotSharp"> <HintPath>$(GodotApiAssembliesDir)/GodotSharp.dll</HintPath> <Private>False</Private> diff --git a/modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs b/modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs index 43b1cf0f64..414729b18e 100644 --- a/modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs +++ b/modules/mono/editor/GodotTools/GodotTools/HotReloadAssemblyWatcher.cs @@ -1,5 +1,6 @@ using Godot; using GodotTools.Internals; +using JetBrains.Annotations; using static GodotTools.Internals.Globals; namespace GodotTools @@ -25,6 +26,7 @@ namespace GodotTools Internal.ReloadAssemblies(softReload: false); } + [UsedImplicitly] public void RestartTimer() { _watchTimer.Stop(); diff --git a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs index 71055f0125..4caab035de 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Ides/Rider/RiderPathLocator.cs @@ -1,9 +1,10 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; +using System.Runtime.Versioning; using Godot; -using JetBrains.Annotations; using Microsoft.Win32; using Newtonsoft.Json; using Directory = System.IO.Directory; @@ -113,6 +114,7 @@ namespace GodotTools.Ides.Rider return installInfos.ToArray(); } + [SupportedOSPlatform("windows")] private static RiderInfo[] CollectRiderInfosWindows() { var installInfos = new List<RiderInfo>(); @@ -217,6 +219,7 @@ namespace GodotTools.Ides.Rider throw new Exception("Unknown OS."); } + [SupportedOSPlatform("windows")] private static void CollectPathsFromRegistry(string registryKey, List<string> installPaths) { using (var key = Registry.CurrentUser.OpenSubKey(registryKey)) @@ -229,6 +232,7 @@ namespace GodotTools.Ides.Rider } } + [SupportedOSPlatform("windows")] private static void CollectPathsFromRegistry(List<string> installPaths, RegistryKey key) { if (key == null) return; @@ -324,7 +328,7 @@ namespace GodotTools.Ides.Rider { public string install_location; - [CanBeNull] + [return: MaybeNull] public static string GetInstallLocationFromJson(string json) { try @@ -378,7 +382,7 @@ namespace GodotTools.Ides.Rider public string version; public string versionSuffix; - [CanBeNull] + [return: MaybeNull] internal static ProductInfo GetProductInfo(string json) { try @@ -402,7 +406,7 @@ namespace GodotTools.Ides.Rider // ReSharper disable once InconsistentNaming public ActiveApplication active_application; - [CanBeNull] + [return: MaybeNull] public static string GetLatestBuildFromJson(string json) { try diff --git a/modules/mono/editor/GodotTools/GodotTools/Internals/EditorProgress.cs b/modules/mono/editor/GodotTools/GodotTools/Internals/EditorProgress.cs index b221ae7c5c..7d2eb2d869 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Internals/EditorProgress.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Internals/EditorProgress.cs @@ -9,23 +9,12 @@ namespace GodotTools.Internals { public string Task { get; } - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_Create(in godot_string task, in godot_string label, int amount, - bool canCancel); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_Dispose(in godot_string task); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern bool internal_Step(in godot_string task, in godot_string state, int step, - bool forceRefresh); - public EditorProgress(string task, string label, int amount, bool canCancel = false) { Task = task; using godot_string taskIn = Marshaling.mono_string_to_godot(task); using godot_string labelIn = Marshaling.mono_string_to_godot(label); - internal_Create(taskIn, labelIn, amount, canCancel); + Internal.godot_icall_EditorProgress_Create(taskIn, labelIn, amount, canCancel); } ~EditorProgress() @@ -39,7 +28,7 @@ namespace GodotTools.Internals public void Dispose() { using godot_string taskIn = Marshaling.mono_string_to_godot(Task); - internal_Dispose(taskIn); + Internal.godot_icall_EditorProgress_Dispose(taskIn); GC.SuppressFinalize(this); } @@ -47,14 +36,14 @@ namespace GodotTools.Internals { using godot_string taskIn = Marshaling.mono_string_to_godot(Task); using godot_string stateIn = Marshaling.mono_string_to_godot(state); - internal_Step(taskIn, stateIn, step, forceRefresh); + Internal.godot_icall_EditorProgress_Step(taskIn, stateIn, step, forceRefresh); } public bool TryStep(string state, int step = -1, bool forceRefresh = true) { using godot_string taskIn = Marshaling.mono_string_to_godot(Task); using godot_string stateIn = Marshaling.mono_string_to_godot(state); - return internal_Step(taskIn, stateIn, step, forceRefresh); + return Internal.godot_icall_EditorProgress_Step(taskIn, stateIn, step, forceRefresh); } } } diff --git a/modules/mono/editor/GodotTools/GodotTools/Internals/Globals.cs b/modules/mono/editor/GodotTools/GodotTools/Internals/Globals.cs index d79821de3c..3b65263aa9 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Internals/Globals.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Internals/Globals.cs @@ -6,13 +6,13 @@ namespace GodotTools.Internals { public static class Globals { - public static float EditorScale => internal_EditorScale(); + public static float EditorScale => Internal.godot_icall_Globals_EditorScale(); public static unsafe object GlobalDef(string setting, object defaultValue, bool restartIfChanged = false) { using godot_string settingIn = Marshaling.mono_string_to_godot(setting); using godot_variant defaultValueIn = Marshaling.mono_object_to_variant(defaultValue); - internal_GlobalDef(settingIn, defaultValueIn, restartIfChanged, out godot_variant result); + Internal.godot_icall_Globals_GlobalDef(settingIn, defaultValueIn, restartIfChanged, out godot_variant result); using (result) return Marshaling.variant_to_mono_object(&result); } @@ -21,7 +21,7 @@ namespace GodotTools.Internals { using godot_string settingIn = Marshaling.mono_string_to_godot(setting); using godot_variant defaultValueIn = Marshaling.mono_object_to_variant(defaultValue); - internal_EditorDef(settingIn, defaultValueIn, restartIfChanged, out godot_variant result); + Internal.godot_icall_Globals_EditorDef(settingIn, defaultValueIn, restartIfChanged, out godot_variant result); using (result) return Marshaling.variant_to_mono_object(&result); } @@ -29,7 +29,7 @@ namespace GodotTools.Internals public static unsafe object EditorShortcut(string setting) { using godot_string settingIn = Marshaling.mono_string_to_godot(setting); - internal_EditorShortcut(settingIn, out godot_variant result); + Internal.godot_icall_Globals_EditorShortcut(settingIn, out godot_variant result); using (result) return Marshaling.variant_to_mono_object(&result); } @@ -38,28 +38,9 @@ namespace GodotTools.Internals public static string TTR(this string text) { using godot_string textIn = Marshaling.mono_string_to_godot(text); - internal_TTR(textIn, out godot_string dest); + Internal.godot_icall_Globals_TTR(textIn, out godot_string dest); using (dest) return Marshaling.mono_string_from_godot(dest); } - - // Internal Calls - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern float internal_EditorScale(); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_GlobalDef(in godot_string setting, in godot_variant defaultValue, - bool restartIfChanged, out godot_variant result); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_EditorDef(in godot_string setting, in godot_variant defaultValue, - bool restartIfChanged, out godot_variant result); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_EditorShortcut(in godot_string setting, out godot_variant result); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_TTR(in godot_string text, out godot_string dest); } } diff --git a/modules/mono/editor/GodotTools/GodotTools/Internals/GodotSharpDirs.cs b/modules/mono/editor/GodotTools/GodotTools/Internals/GodotSharpDirs.cs index b15ebc1ae2..9011662248 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Internals/GodotSharpDirs.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Internals/GodotSharpDirs.cs @@ -9,7 +9,7 @@ namespace GodotTools.Internals { get { - internal_ResMetadataDir(out godot_string dest); + Internal.godot_icall_GodotSharpDirs_ResMetadataDir(out godot_string dest); using (dest) return Marshaling.mono_string_from_godot(dest); } @@ -19,7 +19,7 @@ namespace GodotTools.Internals { get { - internal_ResTempAssembliesBaseDir(out godot_string dest); + Internal.godot_icall_GodotSharpDirs_ResTempAssembliesBaseDir(out godot_string dest); using (dest) return Marshaling.mono_string_from_godot(dest); } @@ -29,7 +29,7 @@ namespace GodotTools.Internals { get { - internal_MonoUserDir(out godot_string dest); + Internal.godot_icall_GodotSharpDirs_MonoUserDir(out godot_string dest); using (dest) return Marshaling.mono_string_from_godot(dest); } @@ -39,7 +39,7 @@ namespace GodotTools.Internals { get { - internal_BuildLogsDirs(out godot_string dest); + Internal.godot_icall_GodotSharpDirs_BuildLogsDirs(out godot_string dest); using (dest) return Marshaling.mono_string_from_godot(dest); } @@ -49,7 +49,7 @@ namespace GodotTools.Internals { get { - internal_ProjectSlnPath(out godot_string dest); + Internal.godot_icall_GodotSharpDirs_ProjectSlnPath(out godot_string dest); using (dest) return Marshaling.mono_string_from_godot(dest); } @@ -59,7 +59,7 @@ namespace GodotTools.Internals { get { - internal_ProjectCsProjPath(out godot_string dest); + Internal.godot_icall_GodotSharpDirs_ProjectCsProjPath(out godot_string dest); using (dest) return Marshaling.mono_string_from_godot(dest); } @@ -69,35 +69,10 @@ namespace GodotTools.Internals { get { - internal_DataEditorToolsDir(out godot_string dest); + Internal.godot_icall_GodotSharpDirs_DataEditorToolsDir(out godot_string dest); using (dest) return Marshaling.mono_string_from_godot(dest); } } - - #region Internal - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_ResMetadataDir(out godot_string r_dest); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_ResTempAssembliesBaseDir(out godot_string r_dest); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_MonoUserDir(out godot_string r_dest); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_BuildLogsDirs(out godot_string r_dest); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_ProjectSlnPath(out godot_string r_dest); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_ProjectCsProjPath(out godot_string r_dest); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_DataEditorToolsDir(out godot_string r_dest); - - #endregion } } diff --git a/modules/mono/editor/GodotTools/GodotTools/Internals/Internal.cs b/modules/mono/editor/GodotTools/GodotTools/Internals/Internal.cs index 7ba26939fa..8e4eb031db 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Internals/Internal.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Internals/Internal.cs @@ -1,12 +1,13 @@ using System; using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using Godot; using Godot.NativeInterop; using GodotTools.IdeMessaging.Requests; namespace GodotTools.Internals { - public static class Internal + internal static class Internal { public const string CSharpLanguageType = "CSharpScript"; public const string CSharpLanguageExtension = ".cs"; @@ -15,7 +16,7 @@ namespace GodotTools.Internals { get { - internal_FullExportTemplatesDir(out godot_string dest); + godot_icall_Internal_FullExportTemplatesDir(out godot_string dest); using (dest) return Marshaling.mono_string_from_godot(dest); } @@ -26,99 +27,161 @@ namespace GodotTools.Internals public static bool IsMacOSAppBundleInstalled(string bundleId) { using godot_string bundleIdIn = Marshaling.mono_string_to_godot(bundleId); - return internal_IsMacOSAppBundleInstalled(bundleIdIn); + return godot_icall_Internal_IsMacOSAppBundleInstalled(bundleIdIn); } - public static bool GodotIs32Bits() => internal_GodotIs32Bits(); + public static bool GodotIs32Bits() => godot_icall_Internal_GodotIs32Bits(); - public static bool GodotIsRealTDouble() => internal_GodotIsRealTDouble(); + public static bool GodotIsRealTDouble() => godot_icall_Internal_GodotIsRealTDouble(); - public static void GodotMainIteration() => internal_GodotMainIteration(); + public static void GodotMainIteration() => godot_icall_Internal_GodotMainIteration(); - public static bool IsAssembliesReloadingNeeded() => internal_IsAssembliesReloadingNeeded(); + public static bool IsAssembliesReloadingNeeded() => godot_icall_Internal_IsAssembliesReloadingNeeded(); - public static void ReloadAssemblies(bool softReload) => internal_ReloadAssemblies(softReload); + public static void ReloadAssemblies(bool softReload) => godot_icall_Internal_ReloadAssemblies(softReload); - public static void EditorDebuggerNodeReloadScripts() => internal_EditorDebuggerNodeReloadScripts(); + public static void EditorDebuggerNodeReloadScripts() => godot_icall_Internal_EditorDebuggerNodeReloadScripts(); public static bool ScriptEditorEdit(Resource resource, int line, int col, bool grabFocus = true) => - internal_ScriptEditorEdit(resource.NativeInstance, line, col, grabFocus); + godot_icall_Internal_ScriptEditorEdit(resource.NativeInstance, line, col, grabFocus); - public static void EditorNodeShowScriptScreen() => internal_EditorNodeShowScriptScreen(); + public static void EditorNodeShowScriptScreen() => godot_icall_Internal_EditorNodeShowScriptScreen(); public static string MonoWindowsInstallRoot { get { - internal_MonoWindowsInstallRoot(out godot_string dest); + godot_icall_Internal_MonoWindowsInstallRoot(out godot_string dest); using (dest) return Marshaling.mono_string_from_godot(dest); } } - public static void EditorRunPlay() => internal_EditorRunPlay(); + public static void EditorRunPlay() => godot_icall_Internal_EditorRunPlay(); - public static void EditorRunStop() => internal_EditorRunStop(); + public static void EditorRunStop() => godot_icall_Internal_EditorRunStop(); - public static void ScriptEditorDebugger_ReloadScripts() => internal_ScriptEditorDebugger_ReloadScripts(); + public static void ScriptEditorDebugger_ReloadScripts() => + godot_icall_Internal_ScriptEditorDebugger_ReloadScripts(); public static unsafe string[] CodeCompletionRequest(CodeCompletionRequest.CompletionKind kind, string scriptFile) { using godot_string scriptFileIn = Marshaling.mono_string_to_godot(scriptFile); - internal_CodeCompletionRequest((int)kind, scriptFileIn, out godot_packed_string_array res); + godot_icall_Internal_CodeCompletionRequest((int)kind, scriptFileIn, out godot_packed_string_array res); using (res) return Marshaling.PackedStringArray_to_mono_array(&res); } #region Internal - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_FullExportTemplatesDir(out godot_string dest); + private const string GodotDllName = "__Internal"; - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern bool internal_IsMacOSAppBundleInstalled(in godot_string bundleId); + [DllImport(GodotDllName)] + public static extern void godot_icall_GodotSharpDirs_ResMetadataDir(out godot_string r_dest); - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern bool internal_GodotIs32Bits(); + [DllImport(GodotDllName)] + public static extern void godot_icall_GodotSharpDirs_ResTempAssembliesBaseDir(out godot_string r_dest); - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern bool internal_GodotIsRealTDouble(); + [DllImport(GodotDllName)] + public static extern void godot_icall_GodotSharpDirs_MonoUserDir(out godot_string r_dest); - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_GodotMainIteration(); + [DllImport(GodotDllName)] + public static extern void godot_icall_GodotSharpDirs_BuildLogsDirs(out godot_string r_dest); - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern bool internal_IsAssembliesReloadingNeeded(); + [DllImport(GodotDllName)] + public static extern void godot_icall_GodotSharpDirs_ProjectSlnPath(out godot_string r_dest); - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_ReloadAssemblies(bool softReload); + [DllImport(GodotDllName)] + public static extern void godot_icall_GodotSharpDirs_ProjectCsProjPath(out godot_string r_dest); - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_EditorDebuggerNodeReloadScripts(); + [DllImport(GodotDllName)] + public static extern void godot_icall_GodotSharpDirs_DataEditorToolsDir(out godot_string r_dest); - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern bool internal_ScriptEditorEdit(IntPtr resource, int line, int col, bool grabFocus); + [DllImport(GodotDllName)] + public static extern void godot_icall_EditorProgress_Create(in godot_string task, in godot_string label, + int amount, bool canCancel); - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_EditorNodeShowScriptScreen(); + [DllImport(GodotDllName)] + public static extern void godot_icall_EditorProgress_Dispose(in godot_string task); - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_MonoWindowsInstallRoot(out godot_string dest); + [DllImport(GodotDllName)] + public static extern bool godot_icall_EditorProgress_Step(in godot_string task, in godot_string state, int step, + bool forceRefresh); - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_EditorRunPlay(); + [DllImport(GodotDllName)] + private static extern void godot_icall_Internal_FullExportTemplatesDir(out godot_string dest); - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_EditorRunStop(); + [DllImport(GodotDllName)] + private static extern void godot_icall_Internal_SimplifyGodotPath(in godot_string path, out godot_string dest); - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_ScriptEditorDebugger_ReloadScripts(); + [DllImport(GodotDllName)] + private static extern bool godot_icall_Internal_IsMacOSAppBundleInstalled(in godot_string bundleId); - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void internal_CodeCompletionRequest(int kind, in godot_string scriptFile, + [DllImport(GodotDllName)] + private static extern bool godot_icall_Internal_GodotIs32Bits(); + + [DllImport(GodotDllName)] + private static extern bool godot_icall_Internal_GodotIsRealTDouble(); + + [DllImport(GodotDllName)] + private static extern void godot_icall_Internal_GodotMainIteration(); + + [DllImport(GodotDllName)] + private static extern bool godot_icall_Internal_IsAssembliesReloadingNeeded(); + + [DllImport(GodotDllName)] + private static extern void godot_icall_Internal_ReloadAssemblies(bool softReload); + + [DllImport(GodotDllName)] + private static extern void godot_icall_Internal_EditorDebuggerNodeReloadScripts(); + + [DllImport(GodotDllName)] + private static extern bool godot_icall_Internal_ScriptEditorEdit(IntPtr resource, int line, int col, + bool grabFocus); + + [DllImport(GodotDllName)] + private static extern void godot_icall_Internal_EditorNodeShowScriptScreen(); + + [DllImport(GodotDllName)] + private static extern void godot_icall_Internal_MonoWindowsInstallRoot(out godot_string dest); + + [DllImport(GodotDllName)] + private static extern void godot_icall_Internal_EditorRunPlay(); + + [DllImport(GodotDllName)] + private static extern void godot_icall_Internal_EditorRunStop(); + + [DllImport(GodotDllName)] + private static extern void godot_icall_Internal_ScriptEditorDebugger_ReloadScripts(); + + [DllImport(GodotDllName)] + private static extern void godot_icall_Internal_CodeCompletionRequest(int kind, in godot_string scriptFile, out godot_packed_string_array res); + [DllImport(GodotDllName)] + public static extern float godot_icall_Globals_EditorScale(); + + [DllImport(GodotDllName)] + public static extern void godot_icall_Globals_GlobalDef(in godot_string setting, in godot_variant defaultValue, + bool restartIfChanged, out godot_variant result); + + [DllImport(GodotDllName)] + public static extern void godot_icall_Globals_EditorDef(in godot_string setting, in godot_variant defaultValue, + bool restartIfChanged, out godot_variant result); + + [DllImport(GodotDllName)] + public static extern void godot_icall_Globals_EditorShortcut(in godot_string setting, out godot_variant result); + + [DllImport(GodotDllName)] + public static extern void godot_icall_Globals_TTR(in godot_string text, out godot_string dest); + + [DllImport(GodotDllName)] + public static extern void godot_icall_Utils_OS_GetPlatformName(out godot_string dest); + + [DllImport(GodotDllName)] + public static extern bool godot_icall_Utils_OS_UnixFileHasExecutableAccess(in godot_string filePath); + #endregion } } diff --git a/modules/mono/editor/GodotTools/GodotTools/Utils/FsPathUtils.cs b/modules/mono/editor/GodotTools/GodotTools/Utils/FsPathUtils.cs index 05499339b1..4f03d46570 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Utils/FsPathUtils.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Utils/FsPathUtils.cs @@ -1,8 +1,8 @@ using System; +using System.Diagnostics.CodeAnalysis; using System.IO; using Godot; using GodotTools.Core; -using JetBrains.Annotations; namespace GodotTools.Utils { @@ -30,7 +30,7 @@ namespace GodotTools.Utils return childPathNorm.PathStartsWithAlreadyNorm(parentPathNorm); } - [CanBeNull] + [return: MaybeNull] public static string LocalizePathWithCaseChecked(string path) { string pathNorm = path.NormalizePath() + Path.DirectorySeparatorChar; diff --git a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs index aa100433c9..d9b5942237 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Utils/OS.cs @@ -6,19 +6,13 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Runtime.CompilerServices; -using JetBrains.Annotations; +using GodotTools.Internals; namespace GodotTools.Utils { [SuppressMessage("ReSharper", "InconsistentNaming")] public static class OS { - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern void GetPlatformName(out godot_string dest); - - [MethodImpl(MethodImplOptions.InternalCall)] - private static extern bool UnixFileHasExecutableAccess(in godot_string filePath); - public static class Names { public const string Windows = "Windows"; @@ -66,7 +60,7 @@ namespace GodotTools.Utils private static unsafe bool IsOS(string name) { - GetPlatformName(out godot_string dest); + Internal.godot_icall_Utils_OS_GetPlatformName(out godot_string dest); using (dest) { string platformName = Marshaling.mono_string_from_godot(dest); @@ -76,7 +70,7 @@ namespace GodotTools.Utils private static unsafe bool IsAnyOS(IEnumerable<string> names) { - GetPlatformName(out godot_string dest); + Internal.godot_icall_Utils_OS_GetPlatformName(out godot_string dest); using (dest) { string platformName = Marshaling.mono_string_from_godot(dest); @@ -102,14 +96,23 @@ namespace GodotTools.Utils private static readonly Lazy<bool> _isHTML5 = new Lazy<bool>(() => IsOS(Names.HTML5)); private static readonly Lazy<bool> _isUnixLike = new Lazy<bool>(() => IsAnyOS(UnixLikePlatforms)); + // TODO SupportedOSPlatformGuard once we target .NET 6 + // [SupportedOSPlatformGuard("windows")] public static bool IsWindows => _isWindows.Value || IsUWP; + // [SupportedOSPlatformGuard("osx")] public static bool IsMacOS => _isMacOS.Value; + // [SupportedOSPlatformGuard("linux")] public static bool IsLinuxBSD => _isLinuxBSD.Value; + // [SupportedOSPlatformGuard("linux")] public static bool IsServer => _isServer.Value; + // [SupportedOSPlatformGuard("windows")] public static bool IsUWP => _isUWP.Value; public static bool IsHaiku => _isHaiku.Value; + // [SupportedOSPlatformGuard("android")] public static bool IsAndroid => _isAndroid.Value; + // [SupportedOSPlatformGuard("ios")] public static bool IsiOS => _isiOS.Value; + // [SupportedOSPlatformGuard("browser")] public static bool IsHTML5 => _isHTML5.Value; public static bool IsUnixLike => _isUnixLike.Value; @@ -183,7 +186,7 @@ namespace GodotTools.Utils .FirstOrDefault(path => { using godot_string pathIn = Marshaling.mono_string_to_godot(path); - return File.Exists(path) && UnixFileHasExecutableAccess(pathIn); + return File.Exists(path) && Internal.godot_icall_Utils_OS_UnixFileHasExecutableAccess(pathIn); }); } |