Another update to the vs9->vs8 converter, to use appropriate line endings.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13084 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2008-08-16 02:10:24 +00:00
parent 420cee95d9
commit d2fa131861

View File

@ -1,14 +1,14 @@
<?php <?php
// Visual Studio 9 to Visual Studio 8 project file converter // Visual Studio 9 to Visual Studio 8 project file converter
// author : theultramage // author : theultramage
// version: 15. august 2008 // version: 16. august 2008
?> ?>
<?php <?php
fprintf(STDERR, "VS9 to VS8 project file converter"."\n"); fwrite(STDERR, "VS9 to VS8 project file converter".PHP_EOL);
fprintf(STDERR, "---------------------------------"."\n"); fwrite(STDERR, "---------------------------------".PHP_EOL);
if( @$_SERVER["argc"] < 2 ) if( @$_SERVER["argc"] < 2 )
{ {
fprintf(STDERR, "Usage: {$_SERVER["argv"][0]} file.vcproj"."\n"); fwrite(STDERR, "Usage: {$_SERVER["argv"][0]} file.vcproj".PHP_EOL);
exit(); exit();
} }
@ -17,15 +17,18 @@
if( $data === FALSE ) if( $data === FALSE )
die("invalid input file '".$input."'"); die("invalid input file '".$input."'");
fprintf(STDERR, "Converting {$input}..."); fwrite(STDERR, "Converting {$input}...".PHP_EOL);
$eol = ( strstr($data[0], "\r\n") !== FALSE ) ? "\r\n" : "\n";
define("EOL", $eol);
foreach( $data as $line ) foreach( $data as $line )
{ {
if( strstr($line,'Version="9,00"') !== FALSE ) if( strstr($line,'Version="9,00"') !== FALSE )
fprintf(STDOUT, "\t".'Version="8,00"'."\n"); fwrite(STDOUT, "\t".'Version="8,00"'.EOL);
else else
if( strstr($line,'Version="9.00"') !== FALSE ) if( strstr($line,'Version="9.00"') !== FALSE )
fprintf(STDOUT, "\t".'Version="8.00"'."\n"); fwrite(STDOUT, "\t".'Version="8.00"'.EOL);
else else
if( strstr($line,'TargetFrameworkVersion') !== FALSE ) if( strstr($line,'TargetFrameworkVersion') !== FALSE )
; ;
@ -36,8 +39,8 @@
if( strstr($line,'DataExecutionPrevention') !== FALSE ) if( strstr($line,'DataExecutionPrevention') !== FALSE )
; ;
else // default else // default
fprintf(STDOUT, $line); fwrite(STDOUT, $line);
} }
fprintf(STDERR, "done."."\n"); fwrite(STDERR, "done.".PHP_EOL);
?> ?>