/**
* Make sure if the $appPath exists and copy the skel to there
* @param string $appPath
*/
public function initialAppPath($appPath)
{
App::uses('Folder', 'Utility');
$fh = new Folder();
if (file_exists($appPath)) {
if (false === $fh->delete($appPath)) {
$this->errorMessage = __('Target path exists. But the program could not delete the folder automatically');
return false;
} else {
$this->tasks[] = array('title' => __('Target path exists. Delete the old folders.'), 'operactions' => $fh->messages());
}
}
/*
* Copy the skelecton of the application
*/
$fh->copy(array('to' => $appPath, 'from' => VENDORS . 'olc_baker' . DS . 'skels' . DS . 'default', 'mode' => 0777));
$errors1 = $fh->errors();
$fh->copy(array('to' => $appPath . DS . 'cake2' . DS . 'lib', 'from' => CAKE_CORE_INCLUDE_PATH, 'mode' => 0777));
$errors2 = $fh->errors();
if (!empty($errors1) || !empty($errors2)) {
$this->errorMessage = __('The program could not copy files to the folder automatically');
return false;
} else {
$this->tasks[] = array('title' => __('Copy the skelecton of application to the target path'), 'operactions' => $fh->messages());
}
return true;
}