From ca47896204482bf4a6979e3838bf7f09f61cebeb Mon Sep 17 00:00:00 2001 From: giy <giy@omp-system.ru> Date: Fri, 02 Sep 2022 14:16:56 +0300 Subject: [PATCH] Обновление до версии 2.9.0 --- QtVsTools.Core/QMake.cs | 30 ++++++++++++++++++++++-------- 1 files changed, 22 insertions(+), 8 deletions(-) diff --git a/QtVsTools.Core/QMake.cs b/QtVsTools.Core/QMake.cs index 4c0a985..3ee46d5 100644 --- a/QtVsTools.Core/QMake.cs +++ b/QtVsTools.Core/QMake.cs @@ -32,23 +32,24 @@ using System.IO; using System.Linq; using System.Text; -using QtVsTools.VisualStudio; namespace QtVsTools.Core { + using VisualStudio; + public abstract class QMake { public Dictionary<string, string> Vars { get; protected set; } public string OutputFile { get; protected set; } - public uint DebugLevel { get; protected set; } + private uint DebugLevel { get; set; } public string TemplatePrefix { get; protected set; } public bool Recursive { get; protected set; } public string ProFile { get; protected set; } public string Query { get; protected set; } public bool DisableWarnings { get; set; } - protected VersionInformation QtVersion { get; private set; } - protected EnvDTE.DTE Dte { get; private set; } + protected VersionInformation QtVersion { get; } + private EnvDTE.DTE Dte { get; } public QMake(VersionInformation qtVersion, EnvDTE.DTE dte = null) { @@ -196,14 +197,27 @@ exitCode = qmakeProc.ExitCode; InfoExit(qmakeProc); } - } catch (Exception e) { - ErrMsg(string.Format("Exception \"{0}\":\r\n{1}", - e.Message, - e.StackTrace)); + } catch (Exception exception) { + exception.Log(); } } return exitCode; } + + public static bool Exists(string path) + { + var possibleQMakePaths = new[] { + // Path points to qmake.exe + path, + // Path points to folder containing qmake.exe + Path.Combine(path, "qmake.exe"), + // Path points to folder containing bin\qmake.exe + Path.Combine(path, "bin", "qmake.exe"), + }; + return possibleQMakePaths.Where(p => File.Exists(p) + && Path.GetFileName(p).Equals("qmake.exe", StringComparison.OrdinalIgnoreCase)) + .Any(); + } } public class QMakeImport : QMake -- Gitblit v1.9.1