|
@@ -32,16 +32,16 @@ namespace BansheeEngine
|
|
|
class VisualStudio
|
|
class VisualStudio
|
|
|
{
|
|
{
|
|
|
private:
|
|
private:
|
|
|
- static const WString SLN_TEMPLATE;
|
|
|
|
|
- static const WString PROJ_ENTRY_TEMPLATE;
|
|
|
|
|
- static const WString PROJ_PLATFORM_TEMPLATE;
|
|
|
|
|
|
|
+ static const String SLN_TEMPLATE;
|
|
|
|
|
+ static const String PROJ_ENTRY_TEMPLATE;
|
|
|
|
|
+ static const String PROJ_PLATFORM_TEMPLATE;
|
|
|
|
|
|
|
|
- static const WString PROJ_TEMPLATE;
|
|
|
|
|
- static const WString REFERENCE_ENTRY_TEMPLATE;
|
|
|
|
|
- static const WString REFERENCE_PROJECT_ENTRY_TEMPLATE;
|
|
|
|
|
- static const WString REFERENCE_PATH_ENTRY_TEMPLATE;
|
|
|
|
|
- static const WString CODE_ENTRY_TEMPLATE;
|
|
|
|
|
- static const WString NON_CODE_ENTRY_TEMPLATE;
|
|
|
|
|
|
|
+ static const String PROJ_TEMPLATE;
|
|
|
|
|
+ static const String REFERENCE_ENTRY_TEMPLATE;
|
|
|
|
|
+ static const String REFERENCE_PROJECT_ENTRY_TEMPLATE;
|
|
|
|
|
+ static const String REFERENCE_PATH_ENTRY_TEMPLATE;
|
|
|
|
|
+ static const String CODE_ENTRY_TEMPLATE;
|
|
|
|
|
+ static const String NON_CODE_ENTRY_TEMPLATE;
|
|
|
|
|
|
|
|
public:
|
|
public:
|
|
|
static CComPtr<EnvDTE::_DTE> findRunningInstance(const CLSID& clsID, const Path& solutionPath)
|
|
static CComPtr<EnvDTE::_DTE> findRunningInstance(const CLSID& clsID, const Path& solutionPath)
|
|
@@ -173,150 +173,153 @@ namespace BansheeEngine
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- static String getSolutionGUID(const WString& solutionName)
|
|
|
|
|
- {
|
|
|
|
|
- static const String guidTemplate = "{0}-{1}-{2}-{3}-{4}";
|
|
|
|
|
- String hash = md5(L"SLN_" + solutionName);
|
|
|
|
|
-
|
|
|
|
|
- return StringUtil::format(guidTemplate, hash.substr(0, 8), hash.substr(8, 4), hash.substr(12, 4), hash.substr(16, 4), hash.substr(20, 12));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
static String getProjectGUID(const WString& projectName)
|
|
static String getProjectGUID(const WString& projectName)
|
|
|
{
|
|
{
|
|
|
static const String guidTemplate = "{0}-{1}-{2}-{3}-{4}";
|
|
static const String guidTemplate = "{0}-{1}-{2}-{3}-{4}";
|
|
|
- String hash = md5(L"PRJ_" + projectName);
|
|
|
|
|
|
|
+ String hash = md5(projectName);
|
|
|
|
|
+
|
|
|
|
|
+ String output = StringUtil::format(guidTemplate, hash.substr(0, 8),
|
|
|
|
|
+ hash.substr(8, 4), hash.substr(12, 4), hash.substr(16, 4), hash.substr(20, 12));
|
|
|
|
|
+ StringUtil::toUpperCase(output);
|
|
|
|
|
|
|
|
- return StringUtil::format(guidTemplate, hash.substr(0, 8), hash.substr(8, 4), hash.substr(12, 4), hash.substr(16, 4), hash.substr(20, 12));
|
|
|
|
|
|
|
+ return output;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- static WString writeSolution(VisualStudioVersion version, const CodeSolutionData& data)
|
|
|
|
|
|
|
+ static String writeSolution(VisualStudioVersion version, const CodeSolutionData& data)
|
|
|
{
|
|
{
|
|
|
struct VersionData
|
|
struct VersionData
|
|
|
{
|
|
{
|
|
|
- WString formatVersion;
|
|
|
|
|
|
|
+ String formatVersion;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
Map<VisualStudioVersion, VersionData> versionData =
|
|
Map<VisualStudioVersion, VersionData> versionData =
|
|
|
{
|
|
{
|
|
|
- { VisualStudioVersion::VS2008, { L"10.0" } },
|
|
|
|
|
- { VisualStudioVersion::VS2010, { L"11.0" } },
|
|
|
|
|
- { VisualStudioVersion::VS2012, { L"12.0" } },
|
|
|
|
|
- { VisualStudioVersion::VS2013, { L"12.0" } },
|
|
|
|
|
- { VisualStudioVersion::VS2015, { L"12.0" } }
|
|
|
|
|
|
|
+ { VisualStudioVersion::VS2008, { "10.00" } },
|
|
|
|
|
+ { VisualStudioVersion::VS2010, { "11.00" } },
|
|
|
|
|
+ { VisualStudioVersion::VS2012, { "12.00" } },
|
|
|
|
|
+ { VisualStudioVersion::VS2013, { "12.00" } },
|
|
|
|
|
+ { VisualStudioVersion::VS2015, { "12.00" } }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- WString solutionGUID = toWString(getSolutionGUID(data.name));
|
|
|
|
|
-
|
|
|
|
|
- WStringStream projectEntriesStream;
|
|
|
|
|
- WStringStream projectPlatformsStream;
|
|
|
|
|
|
|
+ StringStream projectEntriesStream;
|
|
|
|
|
+ StringStream projectPlatformsStream;
|
|
|
for (auto& project : data.projects)
|
|
for (auto& project : data.projects)
|
|
|
{
|
|
{
|
|
|
- WString guid = toWString(getProjectGUID(project.name));
|
|
|
|
|
|
|
+ String guid = getProjectGUID(project.name);
|
|
|
|
|
+ String projectName = toString(project.name);
|
|
|
|
|
|
|
|
- projectEntriesStream << StringUtil::format(PROJ_ENTRY_TEMPLATE, solutionGUID, project.name, project.name + L".csproj", guid) << std::endl;
|
|
|
|
|
- projectPlatformsStream << StringUtil::format(PROJ_PLATFORM_TEMPLATE, guid) << std::endl;
|
|
|
|
|
|
|
+ projectEntriesStream << StringUtil::format(PROJ_ENTRY_TEMPLATE, projectName, projectName + ".csproj", guid);
|
|
|
|
|
+ projectPlatformsStream << StringUtil::format(PROJ_PLATFORM_TEMPLATE, guid);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- WString projectEntries = projectEntriesStream.str();
|
|
|
|
|
- WString projectPlatforms = projectPlatformsStream.str();
|
|
|
|
|
|
|
+ String projectEntries = projectEntriesStream.str();
|
|
|
|
|
+ String projectPlatforms = projectPlatformsStream.str();
|
|
|
|
|
|
|
|
return StringUtil::format(SLN_TEMPLATE, versionData[version].formatVersion, projectEntries, projectPlatforms);
|
|
return StringUtil::format(SLN_TEMPLATE, versionData[version].formatVersion, projectEntries, projectPlatforms);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- static WString writeProject(VisualStudioVersion version, const CodeProjectData& projectData)
|
|
|
|
|
|
|
+ static String writeProject(VisualStudioVersion version, const CodeProjectData& projectData)
|
|
|
{
|
|
{
|
|
|
struct VersionData
|
|
struct VersionData
|
|
|
{
|
|
{
|
|
|
- WString toolsVersion;
|
|
|
|
|
|
|
+ String toolsVersion;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
Map<VisualStudioVersion, VersionData> versionData =
|
|
Map<VisualStudioVersion, VersionData> versionData =
|
|
|
{
|
|
{
|
|
|
- { VisualStudioVersion::VS2008, { L"3.5" } },
|
|
|
|
|
- { VisualStudioVersion::VS2010, { L"4.0" } },
|
|
|
|
|
- { VisualStudioVersion::VS2012, { L"4.0" } },
|
|
|
|
|
- { VisualStudioVersion::VS2013, { L"12.0" } },
|
|
|
|
|
- { VisualStudioVersion::VS2015, { L"13.0" } }
|
|
|
|
|
|
|
+ { VisualStudioVersion::VS2008, { "3.5" } },
|
|
|
|
|
+ { VisualStudioVersion::VS2010, { "4.0" } },
|
|
|
|
|
+ { VisualStudioVersion::VS2012, { "4.0" } },
|
|
|
|
|
+ { VisualStudioVersion::VS2013, { "12.0" } },
|
|
|
|
|
+ { VisualStudioVersion::VS2015, { "13.0" } }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- WStringStream tempStream;
|
|
|
|
|
|
|
+ StringStream tempStream;
|
|
|
for (auto& codeEntry : projectData.codeFiles)
|
|
for (auto& codeEntry : projectData.codeFiles)
|
|
|
- tempStream << StringUtil::format(CODE_ENTRY_TEMPLATE, codeEntry.toWString()) << std::endl;
|
|
|
|
|
|
|
+ tempStream << StringUtil::format(CODE_ENTRY_TEMPLATE, codeEntry.toString());
|
|
|
|
|
|
|
|
- WString codeEntries = tempStream.str();
|
|
|
|
|
- tempStream.str(L"");
|
|
|
|
|
|
|
+ String codeEntries = tempStream.str();
|
|
|
|
|
+ tempStream.str("");
|
|
|
tempStream.clear();
|
|
tempStream.clear();
|
|
|
|
|
|
|
|
for (auto& nonCodeEntry : projectData.nonCodeFiles)
|
|
for (auto& nonCodeEntry : projectData.nonCodeFiles)
|
|
|
- tempStream << StringUtil::format(NON_CODE_ENTRY_TEMPLATE, nonCodeEntry.toWString()) << std::endl;
|
|
|
|
|
|
|
+ tempStream << StringUtil::format(NON_CODE_ENTRY_TEMPLATE, nonCodeEntry.toString());
|
|
|
|
|
|
|
|
- WString nonCodeEntries = tempStream.str();
|
|
|
|
|
- tempStream.str(L"");
|
|
|
|
|
|
|
+ String nonCodeEntries = tempStream.str();
|
|
|
|
|
+ tempStream.str("");
|
|
|
tempStream.clear();
|
|
tempStream.clear();
|
|
|
|
|
|
|
|
for (auto& referenceEntry : projectData.assemblyReferences)
|
|
for (auto& referenceEntry : projectData.assemblyReferences)
|
|
|
{
|
|
{
|
|
|
|
|
+ String referenceName = toString(referenceEntry.name);
|
|
|
|
|
+
|
|
|
if (referenceEntry.path.isEmpty())
|
|
if (referenceEntry.path.isEmpty())
|
|
|
- tempStream << StringUtil::format(REFERENCE_ENTRY_TEMPLATE, referenceEntry.name) << std::endl;
|
|
|
|
|
|
|
+ tempStream << StringUtil::format(REFERENCE_ENTRY_TEMPLATE, referenceName);
|
|
|
else
|
|
else
|
|
|
- tempStream << StringUtil::format(REFERENCE_PATH_ENTRY_TEMPLATE, referenceEntry.name, referenceEntry.path.toWString()) << std::endl;
|
|
|
|
|
|
|
+ tempStream << StringUtil::format(REFERENCE_PATH_ENTRY_TEMPLATE, referenceName, referenceEntry.path.toString());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- WString referenceEntries = tempStream.str();
|
|
|
|
|
- tempStream.str(L"");
|
|
|
|
|
|
|
+ String referenceEntries = tempStream.str();
|
|
|
|
|
+ tempStream.str("");
|
|
|
tempStream.clear();
|
|
tempStream.clear();
|
|
|
|
|
|
|
|
for (auto& referenceEntry : projectData.projectReferences)
|
|
for (auto& referenceEntry : projectData.projectReferences)
|
|
|
{
|
|
{
|
|
|
- WString projectGUID = toWString(getProjectGUID(referenceEntry.name));
|
|
|
|
|
- tempStream << StringUtil::format(REFERENCE_PROJECT_ENTRY_TEMPLATE, referenceEntry.name, projectGUID) << std::endl;
|
|
|
|
|
|
|
+ String referenceName = toString(referenceEntry.name);
|
|
|
|
|
+ String projectGUID = getProjectGUID(referenceEntry.name);
|
|
|
|
|
+
|
|
|
|
|
+ tempStream << StringUtil::format(REFERENCE_PROJECT_ENTRY_TEMPLATE, referenceName, projectGUID);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- WString projectReferenceEntries = tempStream.str();
|
|
|
|
|
- tempStream.str(L"");
|
|
|
|
|
|
|
+ String projectReferenceEntries = tempStream.str();
|
|
|
|
|
+ tempStream.str("");
|
|
|
tempStream.clear();
|
|
tempStream.clear();
|
|
|
|
|
|
|
|
for (auto& define : projectData.defines)
|
|
for (auto& define : projectData.defines)
|
|
|
- tempStream << define << L";";
|
|
|
|
|
|
|
+ tempStream << toString(define) << ";";
|
|
|
|
|
|
|
|
- WString defines = tempStream.str();
|
|
|
|
|
- WString projectGUID = toWString(getProjectGUID(projectData.name));
|
|
|
|
|
|
|
+ String defines = tempStream.str();
|
|
|
|
|
+ String projectGUID = getProjectGUID(projectData.name);
|
|
|
|
|
|
|
|
- return StringUtil::format(PROJ_ENTRY_TEMPLATE, versionData[version].toolsVersion, projectGUID,
|
|
|
|
|
- projectData.name, defines, referenceEntries, projectReferenceEntries, codeEntries, nonCodeEntries);
|
|
|
|
|
|
|
+ return StringUtil::format(PROJ_TEMPLATE, versionData[version].toolsVersion, projectGUID,
|
|
|
|
|
+ toString(projectData.name), defines, referenceEntries, projectReferenceEntries, codeEntries, nonCodeEntries);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const WString VisualStudio::SLN_TEMPLATE =
|
|
|
|
|
- LR"(Microsoft Visual Studio Solution File, Format Version {0}
|
|
|
|
|
-{1}
|
|
|
|
|
|
|
+ const String VisualStudio::SLN_TEMPLATE =
|
|
|
|
|
+ R"(Microsoft Visual Studio Solution File, Format Version {0}
|
|
|
|
|
+# Visual Studio 2013
|
|
|
|
|
+VisualStudioVersion = 12.0.30723.0
|
|
|
|
|
+MinimumVisualStudioVersion = 10.0.40219.1{1}
|
|
|
Global
|
|
Global
|
|
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
|
Debug|Any CPU = Debug|Any CPU
|
|
Debug|Any CPU = Debug|Any CPU
|
|
|
Release|Any CPU = Release|Any CPU
|
|
Release|Any CPU = Release|Any CPU
|
|
|
EndGlobalSection
|
|
EndGlobalSection
|
|
|
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
|
|
|
- {2}
|
|
|
|
|
|
|
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution{2}
|
|
|
EndGlobalSection
|
|
EndGlobalSection
|
|
|
GlobalSection(SolutionProperties) = preSolution
|
|
GlobalSection(SolutionProperties) = preSolution
|
|
|
HideSolutionNode = FALSE
|
|
HideSolutionNode = FALSE
|
|
|
EndGlobalSection
|
|
EndGlobalSection
|
|
|
-EndGlobal)";
|
|
|
|
|
|
|
+EndGlobal
|
|
|
|
|
+)";
|
|
|
|
|
|
|
|
- const WString VisualStudio::PROJ_ENTRY_TEMPLATE =
|
|
|
|
|
- LR"(Project("\{{0}\}") = "{1}", "{2}", "\{{3}\}"
|
|
|
|
|
|
|
+ const String VisualStudio::PROJ_ENTRY_TEMPLATE =
|
|
|
|
|
+ R"(
|
|
|
|
|
+Project("\{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC\}") = "{0}", "{1}", "\{{2}\}"
|
|
|
EndProject)";
|
|
EndProject)";
|
|
|
|
|
|
|
|
- const WString VisualStudio::PROJ_PLATFORM_TEMPLATE =
|
|
|
|
|
- LR"(\{{0}\}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
|
|
|
|
|
+ const String VisualStudio::PROJ_PLATFORM_TEMPLATE =
|
|
|
|
|
+ R"(
|
|
|
|
|
+ \{{0}\}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
|
\{{0}\}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
\{{0}\}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
|
\{{0}\}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
\{{0}\}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
|
\{{0}\}.Release|Any CPU.Build.0 = Release|Any CPU)";
|
|
\{{0}\}.Release|Any CPU.Build.0 = Release|Any CPU)";
|
|
|
|
|
|
|
|
- const WString VisualStudio::PROJ_TEMPLATE =
|
|
|
|
|
- LR"literal(<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
|
|
|
+ const String VisualStudio::PROJ_TEMPLATE =
|
|
|
|
|
+ R"literal(<?xml version="1.0" encoding="utf-8"?>
|
|
|
<Project ToolsVersion="{0}" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<Project ToolsVersion="{0}" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
|
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
|
|
|
|
|
|
+ <Import Project="$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')" />
|
|
|
<PropertyGroup>
|
|
<PropertyGroup>
|
|
|
<Configuration Condition = " '$(Configuration)' == '' ">Debug</Configuration>
|
|
<Configuration Condition = " '$(Configuration)' == '' ">Debug</Configuration>
|
|
|
<Platform Condition = " '$(Platform)' == '' ">AnyCPU</Platform>
|
|
<Platform Condition = " '$(Platform)' == '' ">AnyCPU</Platform>
|
|
@@ -330,11 +333,12 @@ EndProject)";
|
|
|
<BaseDirectory>Resources</BaseDirectory>
|
|
<BaseDirectory>Resources</BaseDirectory>
|
|
|
<SchemaVersion>2.0</SchemaVersion>
|
|
<SchemaVersion>2.0</SchemaVersion>
|
|
|
</PropertyGroup>
|
|
</PropertyGroup>
|
|
|
- <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
|
|
|
|
|
+ <PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
|
<DebugSymbols>true</DebugSymbols>
|
|
<DebugSymbols>true</DebugSymbols>
|
|
|
<DebugType>full</DebugType>
|
|
<DebugType>full</DebugType>
|
|
|
<Optimize>false</Optimize>
|
|
<Optimize>false</Optimize>
|
|
|
- <OutputPath>Internal\Temp\Assemblies\Debug\</OutputPath>
|
|
|
|
|
|
|
+ <OutputPath>Internal\\Temp\\Assemblies\\Debug\\</OutputPath>
|
|
|
|
|
+ <BaseIntermediateOutputPath>Internal\\Temp\\Assemblies\\</BaseIntermediateOutputPath>
|
|
|
<DefineConstants>DEBUG;TRACE;{3}</DefineConstants>
|
|
<DefineConstants>DEBUG;TRACE;{3}</DefineConstants>
|
|
|
<ErrorReport>prompt</ErrorReport>
|
|
<ErrorReport>prompt</ErrorReport>
|
|
|
<WarningLevel>4</WarningLevel >
|
|
<WarningLevel>4</WarningLevel >
|
|
@@ -342,45 +346,47 @@ EndProject)";
|
|
|
<PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
<PropertyGroup Condition = " '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
|
<DebugType>pdbonly</DebugType>
|
|
<DebugType>pdbonly</DebugType>
|
|
|
<Optimize>true</Optimize>
|
|
<Optimize>true</Optimize>
|
|
|
- <OutputPath>Internal\Temp\Assemblies\Release\</OutputPath>
|
|
|
|
|
|
|
+ <OutputPath>Internal\\Temp\\Assemblies\\Release\\</OutputPath>
|
|
|
|
|
+ <BaseIntermediateOutputPath>Internal\\Temp\\Assemblies\\</BaseIntermediateOutputPath>
|
|
|
<DefineConstants>TRACE;{3}</DefineConstants>
|
|
<DefineConstants>TRACE;{3}</DefineConstants>
|
|
|
<ErrorReport>prompt</ErrorReport>
|
|
<ErrorReport>prompt</ErrorReport>
|
|
|
<WarningLevel>4</WarningLevel>
|
|
<WarningLevel>4</WarningLevel>
|
|
|
</PropertyGroup>
|
|
</PropertyGroup>
|
|
|
- <ItemGroup>
|
|
|
|
|
-{4}
|
|
|
|
|
|
|
+ <ItemGroup>{4}
|
|
|
</ItemGroup>
|
|
</ItemGroup>
|
|
|
- <ItemGroup>
|
|
|
|
|
-{5}
|
|
|
|
|
|
|
+ <ItemGroup>{5}
|
|
|
</ItemGroup>
|
|
</ItemGroup>
|
|
|
- <ItemGroup>
|
|
|
|
|
-{6}
|
|
|
|
|
|
|
+ <ItemGroup>{6}
|
|
|
</ItemGroup>
|
|
</ItemGroup>
|
|
|
- <ItemGroup>
|
|
|
|
|
-{7}
|
|
|
|
|
|
|
+ <ItemGroup>{7}
|
|
|
</ItemGroup>
|
|
</ItemGroup>
|
|
|
- <Import Project = "$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
|
|
|
|
|
|
+ <Import Project = "$(MSBuildToolsPath)\\Microsoft.CSharp.targets"/>
|
|
|
</Project>)literal";
|
|
</Project>)literal";
|
|
|
|
|
|
|
|
- const WString VisualStudio::REFERENCE_ENTRY_TEMPLATE =
|
|
|
|
|
- LR"( <Reference Include="{0}"/>)";
|
|
|
|
|
|
|
+ const String VisualStudio::REFERENCE_ENTRY_TEMPLATE =
|
|
|
|
|
+ R"(
|
|
|
|
|
+ <Reference Include="{0}"/>)";
|
|
|
|
|
|
|
|
- const WString VisualStudio::REFERENCE_PATH_ENTRY_TEMPLATE =
|
|
|
|
|
- LR"( <Reference Include="{0}">
|
|
|
|
|
|
|
+ const String VisualStudio::REFERENCE_PATH_ENTRY_TEMPLATE =
|
|
|
|
|
+ R"(
|
|
|
|
|
+ <Reference Include="{0}">
|
|
|
<HintPath>{1}</HintPath>
|
|
<HintPath>{1}</HintPath>
|
|
|
</Reference>)";
|
|
</Reference>)";
|
|
|
|
|
|
|
|
- const WString VisualStudio::REFERENCE_PROJECT_ENTRY_TEMPLATE =
|
|
|
|
|
- LR"( <ProjectReference Include="{0}.csproj">
|
|
|
|
|
|
|
+ const String VisualStudio::REFERENCE_PROJECT_ENTRY_TEMPLATE =
|
|
|
|
|
+ R"(
|
|
|
|
|
+ <ProjectReference Include="{0}.csproj">
|
|
|
<Project>\{{1}\}</Project>
|
|
<Project>\{{1}\}</Project>
|
|
|
<Name>{0}</Name>
|
|
<Name>{0}</Name>
|
|
|
</ProjectReference>)";
|
|
</ProjectReference>)";
|
|
|
|
|
|
|
|
- const WString VisualStudio::CODE_ENTRY_TEMPLATE =
|
|
|
|
|
- LR"( <Compile Include="{0}"/>)";
|
|
|
|
|
|
|
+ const String VisualStudio::CODE_ENTRY_TEMPLATE =
|
|
|
|
|
+ R"(
|
|
|
|
|
+ <Compile Include="{0}"/>)";
|
|
|
|
|
|
|
|
- const WString VisualStudio::NON_CODE_ENTRY_TEMPLATE =
|
|
|
|
|
- LR"( <None Include="{0}"/>)";
|
|
|
|
|
|
|
+ const String VisualStudio::NON_CODE_ENTRY_TEMPLATE =
|
|
|
|
|
+ R"(
|
|
|
|
|
+ <None Include="{0}"/>)";
|
|
|
|
|
|
|
|
VSCodeEditor::VSCodeEditor(VisualStudioVersion version, const Path& execPath, const WString& CLSID)
|
|
VSCodeEditor::VSCodeEditor(VisualStudioVersion version, const Path& execPath, const WString& CLSID)
|
|
|
:mCLSID(CLSID), mExecPath(execPath), mVersion(version)
|
|
:mCLSID(CLSID), mExecPath(execPath), mVersion(version)
|
|
@@ -406,23 +412,26 @@ EndProject)";
|
|
|
|
|
|
|
|
void VSCodeEditor::syncSolution(const CodeSolutionData& data, const Path& outputPath) const
|
|
void VSCodeEditor::syncSolution(const CodeSolutionData& data, const Path& outputPath) const
|
|
|
{
|
|
{
|
|
|
- WString solutionString = VisualStudio::writeSolution(mVersion, data);
|
|
|
|
|
|
|
+ String solutionString = VisualStudio::writeSolution(mVersion, data);
|
|
|
|
|
+ solutionString = StringUtil::replaceAll(solutionString, "\n", "\r\n");
|
|
|
Path solutionPath = outputPath;
|
|
Path solutionPath = outputPath;
|
|
|
solutionPath.append(data.name + L".sln");
|
|
solutionPath.append(data.name + L".sln");
|
|
|
|
|
|
|
|
for (auto& project : data.projects)
|
|
for (auto& project : data.projects)
|
|
|
{
|
|
{
|
|
|
- WString projectString = VisualStudio::writeProject(mVersion, project);
|
|
|
|
|
|
|
+ String projectString = VisualStudio::writeProject(mVersion, project);
|
|
|
|
|
+ projectString = StringUtil::replaceAll(projectString, "\n", "\r\n");
|
|
|
|
|
+
|
|
|
Path projectPath = outputPath;
|
|
Path projectPath = outputPath;
|
|
|
projectPath.append(project.name + L".csproj");
|
|
projectPath.append(project.name + L".csproj");
|
|
|
|
|
|
|
|
DataStreamPtr projectStream = FileSystem::createAndOpenFile(projectPath);
|
|
DataStreamPtr projectStream = FileSystem::createAndOpenFile(projectPath);
|
|
|
- projectStream->write(projectString.c_str(), projectString.size());
|
|
|
|
|
|
|
+ projectStream->write(projectString.c_str(), projectString.size() * sizeof(String::value_type));
|
|
|
projectStream->close();
|
|
projectStream->close();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
DataStreamPtr solutionStream = FileSystem::createAndOpenFile(solutionPath);
|
|
DataStreamPtr solutionStream = FileSystem::createAndOpenFile(solutionPath);
|
|
|
- solutionStream->write(solutionString.c_str(), solutionString.size());
|
|
|
|
|
|
|
+ solutionStream->write(solutionString.c_str(), solutionString.size() * sizeof(String::value_type));
|
|
|
solutionStream->close();
|
|
solutionStream->close();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -433,7 +442,7 @@ EndProject)";
|
|
|
mAvailableEditors.push_back(version.first);
|
|
mAvailableEditors.push_back(version.first);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Map<WString, VSCodeEditorFactory::VSVersionInfo> VSCodeEditorFactory::getAvailableVersions() const
|
|
|
|
|
|
|
+ Map<CodeEditorType, VSCodeEditorFactory::VSVersionInfo> VSCodeEditorFactory::getAvailableVersions() const
|
|
|
{
|
|
{
|
|
|
#if BS_ARCH_TYPE == BS_ARCHITECTURE_x86_64
|
|
#if BS_ARCH_TYPE == BS_ARCHITECTURE_x86_64
|
|
|
bool is64bit = true;
|
|
bool is64bit = true;
|
|
@@ -444,12 +453,13 @@ EndProject)";
|
|
|
|
|
|
|
|
WString registryKeyRoot;
|
|
WString registryKeyRoot;
|
|
|
if (is64bit)
|
|
if (is64bit)
|
|
|
- registryKeyRoot = L"SOFTWARE\\Microsoft";
|
|
|
|
|
|
|
+ registryKeyRoot = L"SOFTWARE\\Wow6432Node\\Microsoft";
|
|
|
else
|
|
else
|
|
|
- registryKeyRoot = L"SOFTWARE\\Wow6432Node\\Microsoft";
|
|
|
|
|
|
|
+ registryKeyRoot = L"SOFTWARE\\Microsoft";
|
|
|
|
|
|
|
|
struct VersionData
|
|
struct VersionData
|
|
|
{
|
|
{
|
|
|
|
|
+ CodeEditorType type;
|
|
|
WString registryKey;
|
|
WString registryKey;
|
|
|
WString name;
|
|
WString name;
|
|
|
WString executable;
|
|
WString executable;
|
|
@@ -457,20 +467,20 @@ EndProject)";
|
|
|
|
|
|
|
|
Map<VisualStudioVersion, VersionData> versionToVersionNumber =
|
|
Map<VisualStudioVersion, VersionData> versionToVersionNumber =
|
|
|
{
|
|
{
|
|
|
- { VisualStudioVersion::VS2008, { L"VisualStudio\\9.0", L"Visual Studio 2008", L"devenv.exe" } },
|
|
|
|
|
- { VisualStudioVersion::VS2010, { L"VisualStudio\\10.0", L"Visual Studio 2010", L"devenv.exe" } },
|
|
|
|
|
- { VisualStudioVersion::VS2012, { L"VisualStudio\\11.0", L"Visual Studio 2012", L"devenv.exe" } },
|
|
|
|
|
- { VisualStudioVersion::VS2013, { L"VisualStudio\\12.0", L"Visual Studio 2013", L"devenv.exe" } },
|
|
|
|
|
- { VisualStudioVersion::VS2015, { L"VisualStudio\\13.0", L"Visual Studio 2015", L"devenv.exe" } }
|
|
|
|
|
|
|
+ { VisualStudioVersion::VS2008, { CodeEditorType::VS2008, L"VisualStudio\\9.0", L"Visual Studio 2008", L"devenv.exe" } },
|
|
|
|
|
+ { VisualStudioVersion::VS2010, { CodeEditorType::VS2010, L"VisualStudio\\10.0", L"Visual Studio 2010", L"devenv.exe" } },
|
|
|
|
|
+ { VisualStudioVersion::VS2012, { CodeEditorType::VS2012, L"VisualStudio\\11.0", L"Visual Studio 2012", L"devenv.exe" } },
|
|
|
|
|
+ { VisualStudioVersion::VS2013, { CodeEditorType::VS2013, L"VisualStudio\\12.0", L"Visual Studio 2013", L"devenv.exe" } },
|
|
|
|
|
+ { VisualStudioVersion::VS2015, { CodeEditorType::VS2015, L"VisualStudio\\13.0", L"Visual Studio 2015", L"devenv.exe" } }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- Map<WString, VSVersionInfo> versionInfo;
|
|
|
|
|
|
|
+ Map<CodeEditorType, VSVersionInfo> versionInfo;
|
|
|
for(auto version : versionToVersionNumber)
|
|
for(auto version : versionToVersionNumber)
|
|
|
{
|
|
{
|
|
|
WString registryKey = registryKeyRoot + L"\\" + version.second.registryKey;
|
|
WString registryKey = registryKeyRoot + L"\\" + version.second.registryKey;
|
|
|
|
|
|
|
|
HKEY regKey;
|
|
HKEY regKey;
|
|
|
- LONG result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, registryKeyRoot.c_str(), 0, KEY_READ, ®Key);
|
|
|
|
|
|
|
+ LONG result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, registryKey.c_str(), 0, KEY_READ, ®Key);
|
|
|
if (result != ERROR_SUCCESS)
|
|
if (result != ERROR_SUCCESS)
|
|
|
continue;
|
|
continue;
|
|
|
|
|
|
|
@@ -488,7 +498,7 @@ EndProject)";
|
|
|
info.CLSID = clsID;
|
|
info.CLSID = clsID;
|
|
|
info.version = version.first;
|
|
info.version = version.first;
|
|
|
|
|
|
|
|
- versionInfo[info.name] = info;
|
|
|
|
|
|
|
+ versionInfo[version.second.type] = info;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// TODO - Also query for VSExpress and VSCommunity (their registry keys are different)
|
|
// TODO - Also query for VSExpress and VSCommunity (their registry keys are different)
|
|
@@ -496,9 +506,9 @@ EndProject)";
|
|
|
return versionInfo;
|
|
return versionInfo;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- CodeEditor* VSCodeEditorFactory::create(const WString& editor) const
|
|
|
|
|
|
|
+ CodeEditor* VSCodeEditorFactory::create(CodeEditorType type) const
|
|
|
{
|
|
{
|
|
|
- auto findIter = mAvailableVersions.find(editor);
|
|
|
|
|
|
|
+ auto findIter = mAvailableVersions.find(type);
|
|
|
if (findIter == mAvailableVersions.end())
|
|
if (findIter == mAvailableVersions.end())
|
|
|
return nullptr;
|
|
return nullptr;
|
|
|
|
|
|