@matheusbsbs / matheus-bagliano / commits / 76031f191e
Fork 0

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 <sschuberth@gmail.com> Acked-by: Marius Storm-Olsen <mstormo@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Sebastian Schuberth committed Sep 28, 2009 at 13:34 UTC 76031f191e5ea340f0a1501125891ae0fed76ff7
1 file changed +4 -1
contrib/buildsystems/Generators/Vcproj.pm
+4 -1
@@ -131,6 +131,7 @@ sub createLibProject {
131 $includes =~ s/-I//g;
132 mkdir "$target" || die "Could not create the directory $target for lib project!\n";
133 open F, ">$target/$target.vcproj" || die "Could not open $target/$target.pro for writing!\n";
134 + binmode F, ":crlf";
135 print F << "EOM";
136 <?xml version="1.0" encoding = "Windows-1252"?>
137 <VisualStudioProject
@@ -353,6 +354,7 @@ sub createAppProject {
354 $includes =~ s/-I//g;
355 mkdir "$target" || die "Could not create the directory $target for lib project!\n";
356 open F, ">$target/$target.vcproj" || die "Could not open $target/$target.pro for writing!\n";
357 + binmode F, ":crlf";
358 print F << "EOM";
359 <?xml version="1.0" encoding = "Windows-1252"?>
360 <VisualStudioProject
@@ -537,7 +539,7 @@ sub createGlueProject {
539 print "Generate solutions file\n";
540 $rel_dir = "..\\$rel_dir";
541 $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";
543 my $SLN_PRE = "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = ";
544 my $SLN_POST = "\nEndProject\n";
545
@@ -560,6 +562,7 @@ sub createGlueProject {
562 @apps = @tmp;
563
564 open F, ">git.sln" || die "Could not open git.sln for writing!\n";
565 + binmode F, ":crlf";
566 print F "$SLN_HEAD";
567 foreach (@libs) {
568 my $libname = $_;