From c68aedb9c4a69d4c5b014694034a8eaab93a58bb Mon Sep 17 00:00:00 2001 From: gwoo Date: Thu, 25 Oct 2007 02:22:40 +0000 Subject: [PATCH] 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 --- cake/console/libs/shell.php | 7 +++++++ cake/libs/file.php | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cake/console/libs/shell.php b/cake/console/libs/shell.php index 0dcf802a3..8ac484838 100644 --- a/cake/console/libs/shell.php +++ b/cake/console/libs/shell.php @@ -433,6 +433,13 @@ class Shell extends Object { if (!class_exists('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)) { $File->write($contents); $this->out(__("Wrote", true) ." {$path}"); diff --git a/cake/libs/file.php b/cake/libs/file.php index 1803360d5..cbd20499f 100644 --- a/cake/libs/file.php +++ b/cake/libs/file.php @@ -216,11 +216,6 @@ class File extends Object { 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) { $success = true;