Browse code

Fixed wrong path detection on Windows

Sebastiaan Stok authored on08/31/2012 09:34:02
Showing2 changed files
... ...
@@ -1,6 +1,6 @@
1 1
 <?php
2 2
 
3
-if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
3
+if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && !defined('WINDOWS_BUILD')) {
4 4
     define('WINDOWS_BUILD', 1);
5 5
 }
6 6
 
... ...
@@ -17,4 +17,4 @@ $app->mount('', new GitList\Controller\BlobController());
17 17
 $app->mount('', new GitList\Controller\CommitController());
18 18
 $app->mount('', new GitList\Controller\TreeController());
19 19
 
20
-return $app;
21 20
\ No newline at end of file
21
+return $app;
... ...
@@ -90,7 +90,9 @@ class Client
90 90
                 $isRepository = file_exists($file->getPathname() . '/.git/HEAD');
91 91
 
92 92
                 if ($isRepository || $isBare) {
93
-                    if (in_array($file->getPathname(), $this->getHidden())) {
93
+                    $pathName = str_replace('\\', '/', $file->getPathname());
94
+
95
+                    if (in_array($pathName, $this->getHidden())) {
94 96
                         continue;
95 97
                     }
96 98
 
... ...
@@ -106,7 +108,7 @@ class Client
106 108
                         $description = 'There is no repository description file. Please, create one to remove this message.';
107 109
                     }
108 110
 
109
-                    $repositories[] = array('name' => $file->getFilename(), 'path' => $file->getPathname(), 'description' => $description);
111
+                    $repositories[] = array('name' => $file->getFilename(), 'path' => $pathName, 'description' => $description);
110 112
                     continue;
111 113
                 }
112 114
             }