Skip to content

Commit 76031f1

Browse files
sschuberthspearce
authored andcommitted
Make generated MSVC solution file open from Windows Explorer
In order to be able to open the generated solution file by double- clicking it in Windows Explorer, all project files need to use DOS line-endings and a comment about the Visual Studio version needs to be added to the header of the solution file. This also fixes the icon that is displayed for the solution file in Windows Explorer. Note that opening the solution file from a running instance of Visual Studio already worked before. Signed-off-by: Sebastian Schuberth <[email protected]> Acked-by: Marius Storm-Olsen <[email protected]> Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent 6f798b9 commit 76031f1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

contrib/buildsystems/Generators/Vcproj.pm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ sub createLibProject {
131131
$includes =~ s/-I//g;
132132
mkdir "$target" || die "Could not create the directory $target for lib project!\n";
133133
open F, ">$target/$target.vcproj" || die "Could not open $target/$target.pro for writing!\n";
134+
binmode F, ":crlf";
134135
print F << "EOM";
135136
<?xml version="1.0" encoding = "Windows-1252"?>
136137
<VisualStudioProject
@@ -353,6 +354,7 @@ sub createAppProject {
353354
$includes =~ s/-I//g;
354355
mkdir "$target" || die "Could not create the directory $target for lib project!\n";
355356
open F, ">$target/$target.vcproj" || die "Could not open $target/$target.pro for writing!\n";
357+
binmode F, ":crlf";
356358
print F << "EOM";
357359
<?xml version="1.0" encoding = "Windows-1252"?>
358360
<VisualStudioProject
@@ -537,7 +539,7 @@ sub createGlueProject {
537539
print "Generate solutions file\n";
538540
$rel_dir = "..\\$rel_dir";
539541
$rel_dir =~ s/\//\\/g;
540-
my $SLN_HEAD = "Microsoft Visual Studio Solution File, Format Version 10.00\n";
542+
my $SLN_HEAD = "Microsoft Visual Studio Solution File, Format Version 10.00\n# Visual Studio 2008\n";
541543
my $SLN_PRE = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = ";
542544
my $SLN_POST = "\nEndProject\n";
543545

@@ -560,6 +562,7 @@ sub createGlueProject {
560562
@apps = @tmp;
561563

562564
open F, ">git.sln" || die "Could not open git.sln for writing!\n";
565+
binmode F, ":crlf";
563566
print F "$SLN_HEAD";
564567
foreach (@libs) {
565568
my $libname = $_;

0 commit comments

Comments
 (0)