Example #1
0
        public static RiderInfo[] GetAllRiderPaths()
        {
            try
            {
                if (OS.IsWindows)
                {
                    return(CollectRiderInfosWindows());
                }
                if (OS.IsOSX)
                {
                    return(CollectRiderInfosMac());
                }
                if (OS.IsUnixLike())
                {
                    return(CollectAllRiderPathsLinux());
                }
                throw new Exception("Unexpected OS.");
            }
            catch (Exception e)
            {
                GD.PushWarning(e.Message);
            }

            return(new RiderInfo[0]);
        }
Example #2
0
        private static string GetToolboxBaseDir()
        {
            if (OS.IsWindows)
            {
                var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                return(GetToolboxRiderRootPath(localAppData));
            }

            if (OS.IsOSX)
            {
                var home = Environment.GetEnvironmentVariable("HOME");
                if (string.IsNullOrEmpty(home))
                {
                    return(string.Empty);
                }
                var localAppData = Path.Combine(home, @"Library/Application Support");
                return(GetToolboxRiderRootPath(localAppData));
            }

            if (OS.IsUnixLike())
            {
                var home = Environment.GetEnvironmentVariable("HOME");
                if (string.IsNullOrEmpty(home))
                {
                    return(string.Empty);
                }
                var localAppData = Path.Combine(home, @".local/share");
                return(GetToolboxRiderRootPath(localAppData));
            }

            return(string.Empty);
        }
Example #3
0
        private static string GetToolboxBaseDir()
        {
            if (OS.IsWindows)
            {
                var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                return(Path.Combine(localAppData, @"JetBrains\Toolbox\apps\Rider"));
            }

            if (OS.IsOSX)
            {
                var home = Environment.GetEnvironmentVariable("HOME");
                if (!string.IsNullOrEmpty(home))
                {
                    return(Path.Combine(home, @"Library/Application Support/JetBrains/Toolbox/apps/Rider"));
                }
            }

            if (OS.IsUnixLike())
            {
                var home = Environment.GetEnvironmentVariable("HOME");
                if (!string.IsNullOrEmpty(home))
                {
                    return(Path.Combine(home, @".local/share/JetBrains/Toolbox/apps/Rider"));
                }
            }

            throw new Exception("Unexpected OS.");
        }
Example #4
0
 private static string GetRelativePathToBuildTxt()
 {
     if (OS.IsWindows || OS.IsUnixLike())
     {
         return("../../build.txt");
     }
     if (OS.IsOSX)
     {
         return("Contents/Resources/build.txt");
     }
     throw new Exception("Unknown OS.");
 }
Example #5
0
        public static string FindMsBuild()
        {
            var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
            var buildTool      = (BuildManager.BuildTool)editorSettings.GetSetting("mono/builds/build_tool");

            if (OS.IsWindows)
            {
                switch (buildTool)
                {
                case BuildManager.BuildTool.MsBuildVs:
                {
                    if (_msbuildToolsPath.Empty() || !File.Exists(_msbuildToolsPath))
                    {
                        // Try to search it again if it wasn't found last time or if it was removed from its location
                        _msbuildToolsPath = FindMsBuildToolsPathOnWindows();

                        if (_msbuildToolsPath.Empty())
                        {
                            throw new FileNotFoundException($"Cannot find executable for '{BuildManager.PropNameMsbuildVs}'.");
                        }
                    }

                    if (!_msbuildToolsPath.EndsWith("\\"))
                    {
                        _msbuildToolsPath += "\\";
                    }

                    return(Path.Combine(_msbuildToolsPath, "MSBuild.exe"));
                }

                case BuildManager.BuildTool.MsBuildMono:
                {
                    string msbuildPath = Path.Combine(Internal.MonoWindowsInstallRoot, "bin", "msbuild.bat");

                    if (!File.Exists(msbuildPath))
                    {
                        throw new FileNotFoundException($"Cannot find executable for '{BuildManager.PropNameMsbuildMono}'. Tried with path: {msbuildPath}");
                    }

                    return(msbuildPath);
                }

                case BuildManager.BuildTool.JetBrainsMsBuild:
                    var editorPath = (string)editorSettings.GetSetting(RiderPathManager.EditorPathSettingName);
                    if (!File.Exists(editorPath))
                    {
                        throw new FileNotFoundException($"Cannot find Rider executable. Tried with path: {editorPath}");
                    }
                    var riderDir = new FileInfo(editorPath).Directory.Parent;
                    return(Path.Combine(riderDir.FullName, @"tools\MSBuild\Current\Bin\MSBuild.exe"));

                default:
                    throw new IndexOutOfRangeException("Invalid build tool in editor settings");
                }
            }

            if (OS.IsUnixLike())
            {
                if (buildTool == BuildManager.BuildTool.MsBuildMono)
                {
                    if (_msbuildUnixPath.Empty() || !File.Exists(_msbuildUnixPath))
                    {
                        // Try to search it again if it wasn't found last time or if it was removed from its location
                        _msbuildUnixPath = FindBuildEngineOnUnix("msbuild");
                    }

                    if (_msbuildUnixPath.Empty())
                    {
                        throw new FileNotFoundException($"Cannot find binary for '{BuildManager.PropNameMsbuildMono}'");
                    }

                    return(_msbuildUnixPath);
                }
                else
                {
                    throw new IndexOutOfRangeException("Invalid build tool in editor settings");
                }
            }

            throw new PlatformNotSupportedException();
        }