@@ -38,16 +38,10 @@ public function setUp()
3838
3939 protected function parseFile ($ file )
4040 {
41- $ path = $ this -> dataPath ($ file );
41+ $ path = data_path ($ file );
4242 return zephir_parse_file (file_get_contents ($ path ), $ path );
4343 }
4444
45- protected function dataPath ($ path )
46- {
47- $ normalized = str_replace (['\\' , '/ ' ], DIRECTORY_SEPARATOR , $ path );
48- return ZEPHIR_PARSER_DATA . DIRECTORY_SEPARATOR . ltrim ($ normalized , DIRECTORY_SEPARATOR );
49- }
50-
5145 /**
5246 * Clean output directory from the generated files.
5347 */
@@ -64,15 +58,20 @@ protected function cleanOutputDir()
6458 new RecursiveIteratorIterator ($ directoryIterator , RecursiveIteratorIterator::CHILD_FIRST )
6559 );
6660
67- foreach ($ iterator as $ file ) {
61+ try {
62+ foreach ($ iterator as $ file ) {
6863 /* @var \SplFileInfo $file */
69- if ($ file ->isFile ()) {
70- if (strpos ($ file ->getBasename (), '. ' ) !== 0 ) {
71- unlink ($ file ->getRealPath ());
72- } elseif ($ file ->isDir ()) {
73- rmdir ($ file ->getRealPath ());
74- }
64+ if ($ file ->isDir ()) {
65+ rmdir ($ file ->getRealPath ());
66+ continue ;
7567 }
68+
69+ if (strpos ($ file ->getBasename (), '. ' ) !== 0 ) {
70+ unlink ($ file ->getRealPath ());
71+ }
72+ }
73+ } catch (\UnexpectedValueException $ e ) {
74+ // Ignore
7675 }
7776 }
7877}
0 commit comments