@@ -27,26 +27,25 @@ private function init($namespace, $directory)
27
27
{
28
28
if (!isset ($ directory [0 ])) {
29
29
$ directory = sys_get_temp_dir ().'/symfony-cache ' ;
30
+ } else {
31
+ $ directory = realpath ($ directory ) ?: $ directory ;
30
32
}
31
33
if (isset ($ namespace [0 ])) {
32
34
if (preg_match ('#[^-+_.A-Za-z0-9]# ' , $ namespace , $ match )) {
33
35
throw new InvalidArgumentException (sprintf ('Namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed. ' , $ match [0 ]));
34
36
}
35
- $ directory .= ' / ' .$ namespace ;
37
+ $ directory .= DIRECTORY_SEPARATOR .$ namespace ;
36
38
}
37
- if (!file_exists ($ dir = $ directory. ' /. ' )) {
39
+ if (!file_exists ($ directory )) {
38
40
@mkdir ($ directory , 0777 , true );
39
41
}
40
- if (false === $ dir = realpath ($ dir ) ?: (file_exists ($ dir ) ? $ dir : false )) {
41
- throw new InvalidArgumentException (sprintf ('Cache directory does not exist (%s) ' , $ directory ));
42
- }
43
- $ dir .= DIRECTORY_SEPARATOR ;
42
+ $ directory .= DIRECTORY_SEPARATOR ;
44
43
// On Windows the whole path is limited to 258 chars
45
- if ('\\' === DIRECTORY_SEPARATOR && strlen ($ dir ) > 234 ) {
44
+ if ('\\' === DIRECTORY_SEPARATOR && strlen ($ directory ) > 234 ) {
46
45
throw new InvalidArgumentException (sprintf ('Cache directory too long (%s) ' , $ directory ));
47
46
}
48
47
49
- $ this ->directory = $ dir ;
48
+ $ this ->directory = $ directory ;
50
49
}
51
50
52
51
/**
0 commit comments