Skip to content
Permalink
Browse files

fixing folder class when path give does not exist

  • Loading branch information...
gwoo
gwoo committed Aug 2, 2009
1 parent f9f67a1 commit ffe801bb2853f90280d94fefad305ed79b233c35
Showing with 16 additions and 1 deletion.
  1. +15 −0 cake/libs/folder.php
  2. +1 −1 cake/tests/cases/libs/folder.test.php
@@ -161,6 +161,9 @@ function cd($path) {
* @access public
*/
function read($sort = true, $exceptions = false, $fullPath = false) {
if (!$this->pwd()) {
return array();
}
$dirs = $files = array();
if (is_array($exceptions)) {
@@ -214,6 +217,9 @@ function find($regexpPattern = '.*', $sort = false) {
* @access public
*/
function findRecursive($pattern = '.*', $sort = false) {
if (!$this->pwd()) {
return array();
}
$startsOn = $this->path;
$out = $this->_findRecursive($pattern, $sort);
$this->cd($startsOn);
@@ -425,6 +431,9 @@ function chmod($path, $mode = false, $recursive = true, $exceptions = array()) {
* @access public
*/
function tree($path, $exceptions = true, $type = null) {
if (!$this->pwd()) {
return array();
}
$original = $this->path;
$path = rtrim($path, DS);
$this->__files = array();
@@ -554,6 +563,9 @@ function delete($path = null) {
if (!$path) {
$path = $this->pwd();
}
if (!$path) {
return null;
}
$path = Folder::slashTerm($path);
if (is_dir($path) === true) {
$normalFiles = glob($path . '*');
@@ -598,6 +610,9 @@ function delete($path = null) {
* @access public
*/
function copy($options = array()) {
if (!$this->pwd()) {
return false;
}
$to = null;
if (is_string($options)) {
$to = $options;
@@ -95,7 +95,7 @@ function testInPath() {
* @return void
*/
function testOperations() {
$path = TEST_CAKE_CORE_INCLUDE_PATH . 'console' . DS . 'libs' . DS . 'templates' . DS . 'skel';
$path = TEST_CAKE_CORE_INCLUDE_PATH . 'console' . DS . 'templates' . DS . 'skel';
$Folder =& new Folder($path);
$result = is_dir($Folder->pwd());

0 comments on commit ffe801b

Please sign in to comment.
You can’t perform that action at this time.