removing line ending code from File::write(), adding it to bake, fixes #3460

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5897 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-10-25 02:22:40 +00:00
parent 9b57b59c28
commit c68aedb9c4
2 changed files with 7 additions and 5 deletions

View file

@ -433,6 +433,13 @@ class Shell extends Object {
if (!class_exists('File')) { if (!class_exists('File')) {
uses('file'); uses('file');
} }
$lineBreak = "\n";
if (substr(PHP_OS,0,3) == "WIN") {
$lineBreak = "\r\n";
}
$data = strtr($contents, array("\r\n" => $lineBreak, "\n" => $lineBreak, "\r" => $lineBreak));
if ($File = new File($path, true)) { if ($File = new File($path, true)) {
$File->write($contents); $File->write($contents);
$this->out(__("Wrote", true) ." {$path}"); $this->out(__("Wrote", true) ." {$path}");

View file

@ -216,11 +216,6 @@ class File extends Object {
return false; return false;
} }
} }
$lineBreak = "\n";
if (substr(PHP_OS,0,3) == "WIN") {
$lineBreak = "\r\n";
}
$data = strtr($data, array("\r\n" => $lineBreak, "\n" => $lineBreak, "\r" => $lineBreak));
if (fwrite($this->handle, $data) !== false) { if (fwrite($this->handle, $data) !== false) {
$success = true; $success = true;