| Conditions | 5 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace Tequilarapido\Cli; |
||
| 25 | protected function getDirFullPath($dir) |
||
| 26 | { |
||
| 27 | // Let's try with nothing : full path ? |
||
| 28 | if (is_dir($dir)) { |
||
| 29 | return $dir; |
||
| 30 | } |
||
| 31 | |||
| 32 | // Let's try current directory |
||
| 33 | $cd = getcwd(); |
||
| 34 | $fullpath = $cd . '/' . $dir; |
||
| 35 | if ($cd && is_dir($fullpath)) { |
||
| 36 | return $fullpath; |
||
| 37 | } |
||
| 38 | |||
| 39 | // If we are on windows using Cygwin, tryout Windows path |
||
| 40 | $cmd = "cygpath -w $dir"; |
||
| 41 | $process = new Process($cmd); |
||
| 42 | $process->run(); |
||
| 43 | if ($process->isSuccessful()) { |
||
| 44 | return trim($process->getOutput()); |
||
| 45 | } |
||
| 46 | |||
| 47 | return false; |
||
| 48 | } |
||
| 49 | |||
| 50 | } |