BUGFIX: Folder::findOrMake() will create the assets/ folder if it's missing (from r99638)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@102872 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-14 04:42:59 +00:00
parent fc551f5e0c
commit 50667bf6c3

View File

@ -48,6 +48,9 @@ class Folder extends File {
* @param $folderPath string Absolute or relative path to the file * @param $folderPath string Absolute or relative path to the file
*/ */
static function findOrMake($folderPath) { static function findOrMake($folderPath) {
// Create assets directory, if it is missing
if(!file_exists(ASSETS_PATH)) mkdir(ASSETS_PATH,Filesystem::$folder_create_mask);
$folderPath = trim(Director::makeRelative($folderPath)); $folderPath = trim(Director::makeRelative($folderPath));
// replace leading and trailing slashes // replace leading and trailing slashes
$folderPath = preg_replace('/^\/?(.*)\/?$/', '$1', $folderPath); $folderPath = preg_replace('/^\/?(.*)\/?$/', '$1', $folderPath);