添加查找QT小工具,将qmake.exe路径写入HKEY_CURRENT_USER\SOFTWARE\Qt\qmake
This commit is contained in:
parent
8ae49ef322
commit
7db4d985b0
|
@ -0,0 +1,88 @@
|
||||||
|
// findqt.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
|
||||||
|
//
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <file/file_util.h>
|
||||||
|
#include <sys/sys_util.h>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <coding/coding.h>
|
||||||
|
|
||||||
|
static INTER_MODULE_CALLBACK(got_wstr)
|
||||||
|
{
|
||||||
|
*((std::wstring*)param) += std::wstring((const wchar_t*)data, len / 2);
|
||||||
|
|
||||||
|
return inter_module_data::SET_RESULT_CONTINUE;
|
||||||
|
}
|
||||||
|
static INTER_MODULE_CALLBACK(got_str)
|
||||||
|
{
|
||||||
|
*((std::string*)param) += std::string(data, len);
|
||||||
|
|
||||||
|
return inter_module_data::SET_RESULT_CONTINUE;
|
||||||
|
}
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::wstring path(L"");
|
||||||
|
|
||||||
|
sys_util::reg_get_string(HKEY_CLASSES_ROOT, L"QtProject.QtCreator.pro\\shell\\Open\\Command", NULL, got_wstr, &path);
|
||||||
|
if (path.empty())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
std::transform(path.begin(), path.end(), path.begin(), tolower);
|
||||||
|
|
||||||
|
size_t pos = path.find(L".exe");
|
||||||
|
if (pos == std::wstring::npos)
|
||||||
|
return -2;
|
||||||
|
pos += 4;
|
||||||
|
if (pos < path.length())
|
||||||
|
{
|
||||||
|
if (path[pos] == L' ')
|
||||||
|
path.erase(pos);
|
||||||
|
else
|
||||||
|
return -3;
|
||||||
|
}
|
||||||
|
|
||||||
|
STR_PARENT_FOLDER(path);
|
||||||
|
STR_PARENT_FOLDER(path);
|
||||||
|
STR_PARENT_FOLDER(path);
|
||||||
|
STR_PARENT_FOLDER(path);
|
||||||
|
|
||||||
|
file_util::IFileFinder* finder = file_util::create_file_finder();
|
||||||
|
file_util::PATHFILE found = { 0 };
|
||||||
|
bool ok = false;
|
||||||
|
|
||||||
|
if (finder->find_first(path.c_str(), &found) == 0)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
std::transform(found.path, found.path + lstrlenW(found.path), found.path, tolower);
|
||||||
|
if (wcsstr(found.path, L"\\qmake.exe"))
|
||||||
|
{
|
||||||
|
if (wcsstr(found.path, L"\\msvc") && !wcsstr(found.path, L"_64") && !wcsstr(found.path, L"_x64"))
|
||||||
|
{
|
||||||
|
ok = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (finder->find_next(&found) == 0);
|
||||||
|
}
|
||||||
|
finder->release();
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
return -4;
|
||||||
|
|
||||||
|
sys_util::reg_set_string(HKEY_CURRENT_USER, L"Software\\Qt", L"qmake", found.path);
|
||||||
|
std::wcout << found.path << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
|
||||||
|
// 调试程序: F5 或调试 >“开始调试”菜单
|
||||||
|
|
||||||
|
// 入门使用技巧:
|
||||||
|
// 1. 使用解决方案资源管理器窗口添加/管理文件
|
||||||
|
// 2. 使用团队资源管理器窗口连接到源代码管理
|
||||||
|
// 3. 使用输出窗口查看生成输出和其他消息
|
||||||
|
// 4. 使用错误列表窗口查看错误
|
||||||
|
// 5. 转到“项目”>“添加新项”以创建新的代码文件,或转到“项目”>“添加现有项”以将现有代码文件添加到项目
|
||||||
|
// 6. 将来,若要再次打开此项目,请转到“文件”>“打开”>“项目”并选择 .sln 文件
|
|
@ -0,0 +1,153 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{1f4bf993-302e-4728-b044-39dc8644c1cc}</ProjectGuid>
|
||||||
|
<RootNamespace>findqt</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
|
||||||
|
<IncludePath>$(SolutionDir)..\sdk\include;$(IncludePath)</IncludePath>
|
||||||
|
<LibraryPath>$(SolutionDir)..\sdk\lib;$(LibraryPath)</LibraryPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
|
||||||
|
<IncludePath>$(SolutionDir)..\sdk\include;$(IncludePath)</IncludePath>
|
||||||
|
<LibraryPath>$(SolutionDir)..\sdk\lib;$(LibraryPath)</LibraryPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="findqt.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="源文件">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="头文件">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="资源文件">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="findqt.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
Binary file not shown.
|
@ -9,6 +9,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hgjson", "..\apps\hgjson\hg
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cvstr", "..\apps\cvstr\cvstr.vcxproj", "{758032ED-6FB3-4E7F-AA8F-A463C2B5D91E}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cvstr", "..\apps\cvstr\cvstr.vcxproj", "{758032ED-6FB3-4E7F-AA8F-A463C2B5D91E}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "findqt", "..\apps\findqt\findqt.vcxproj", "{1F4BF993-302E-4728-B044-39DC8644C1CC}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||||
|
@ -49,6 +51,22 @@ Global
|
||||||
{758032ED-6FB3-4E7F-AA8F-A463C2B5D91E}.Release|x64.ActiveCfg = Release|Win32
|
{758032ED-6FB3-4E7F-AA8F-A463C2B5D91E}.Release|x64.ActiveCfg = Release|Win32
|
||||||
{758032ED-6FB3-4E7F-AA8F-A463C2B5D91E}.Release|x86.ActiveCfg = Release|Win32
|
{758032ED-6FB3-4E7F-AA8F-A463C2B5D91E}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{758032ED-6FB3-4E7F-AA8F-A463C2B5D91E}.Release|x86.Build.0 = Release|Win32
|
{758032ED-6FB3-4E7F-AA8F-A463C2B5D91E}.Release|x86.Build.0 = Release|Win32
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Release|x64.Build.0 = Release|x64
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -56,6 +74,7 @@ Global
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{D3579C48-F5AB-4F15-9B49-A2970FBA76C5} = {434BA17E-2347-4C76-97A2-DF9940EEB9FC}
|
{D3579C48-F5AB-4F15-9B49-A2970FBA76C5} = {434BA17E-2347-4C76-97A2-DF9940EEB9FC}
|
||||||
{758032ED-6FB3-4E7F-AA8F-A463C2B5D91E} = {434BA17E-2347-4C76-97A2-DF9940EEB9FC}
|
{758032ED-6FB3-4E7F-AA8F-A463C2B5D91E} = {434BA17E-2347-4C76-97A2-DF9940EEB9FC}
|
||||||
|
{1F4BF993-302E-4728-B044-39DC8644C1CC} = {434BA17E-2347-4C76-97A2-DF9940EEB9FC}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {8F4909F0-C507-4210-A730-BFFBF9773850}
|
SolutionGuid = {8F4909F0-C507-4210-A730-BFFBF9773850}
|
||||||
|
|
Loading…
Reference in New Issue