Skip to content

Commit 536ca28

Browse files
committed
Ensure all Visual Studio files are generated with CRLF
1 parent 1f0f810 commit 536ca28

File tree

6 files changed

+26
-18
lines changed

6 files changed

+26
-18
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ thirdparty/* linguist-vendored
99
*.bat eol=crlf
1010
# And some test files where the EOL matters
1111
*.test.txt -text
12+
# And also the templates for Visual Studio files, which VS will always force CRLF on
13+
/misc/msvs/*.template eol=crlf
1214

1315
# The above only works properly for Git 2.10+, so for older versions
1416
# we need to manually list the binary files we don't want modified.

methods.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,7 @@ def format_key_value(v):
13261326

13271327
filters_template = filters_template.replace("%%HASH%%", md5)
13281328

1329-
with open(f"{project_name}.vcxproj.filters", "w", encoding="utf-8", newline="\n") as f:
1329+
with open(f"{project_name}.vcxproj.filters", "w", encoding="utf-8", newline="\r\n") as f:
13301330
f.write(filters_template)
13311331

13321332
envsources = []
@@ -1507,7 +1507,7 @@ def format_key_value(v):
15071507
props_template = props_template.replace("%%CLEAN%%", cmd)
15081508

15091509
with open(
1510-
f"{project_name}.{platform}.{target}.{arch}.generated.props", "w", encoding="utf-8", newline="\n"
1510+
f"{project_name}.{platform}.{target}.{arch}.generated.props", "w", encoding="utf-8", newline="\r\n"
15111511
) as f:
15121512
f.write(props_template)
15131513

@@ -1624,7 +1624,7 @@ def format_key_value(v):
16241624
sln_template = sln_template.replace("%%SECTION1%%", "\n ".join(section1))
16251625
sln_template = sln_template.replace("%%SECTION2%%", "\n ".join(section2))
16261626

1627-
with open(f"{project_name}.sln", "w", encoding="utf-8", newline="\n") as f:
1627+
with open(f"{project_name}.sln", "w", encoding="utf-8", newline="\r\n") as f:
16281628
f.write(sln_template)
16291629

16301630
if get_bool(original_args, "vsproj_gen_only", True):

misc/msvs/props.template

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@
1818
<ItemGroup Condition="%%CONDITION%%">
1919
%%EXTRA_ITEMS%%
2020
</ItemGroup>
21-
</Project>
21+
</Project>
22+
<!-- CHECKSUM
23+
%%HASH%%
24+
-->

misc/msvs/sln.template

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "%%NAME%%", "%%NAME%%.vcxproj", "{%%UUID%%}"
66
EndProject
77
Global
8-
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9-
%%SECTION1%%
10-
EndGlobalSection
11-
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12-
%%SECTION2%%
13-
EndGlobalSection
14-
GlobalSection(SolutionProperties) = preSolution
15-
HideSolutionNode = FALSE
16-
EndGlobalSection
17-
GlobalSection(ExtensibilityGlobals) = postSolution
18-
SolutionGuid = {%%SLNUUID%%}
19-
EndGlobalSection
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
%%SECTION1%%
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
%%SECTION2%%
13+
EndGlobalSection
14+
GlobalSection(SolutionProperties) = preSolution
15+
HideSolutionNode = FALSE
16+
EndGlobalSection
17+
GlobalSection(ExtensibilityGlobals) = postSolution
18+
SolutionGuid = {%%SLNUUID%%}
19+
EndGlobalSection
2020
EndGlobal

misc/msvs/vcxproj.filters.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@
2727
</Project>
2828
<!-- CHECKSUM
2929
%%HASH%%
30-
-->
30+
-->

misc/msvs/vcxproj.template

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,7 @@
3737
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
3838
<ImportGroup Label="ExtensionTargets">
3939
</ImportGroup>
40-
</Project>
40+
</Project>
41+
<!-- CHECKSUM
42+
%%HASH%%
43+
-->

0 commit comments

Comments
 (0)