@@ -393,6 +393,7 @@ public function getDirectory ($key) {
393393 */
394394 public function setPath ($ path ) {
395395 $ this ->info ['path ' ] = array ();
396+ $ this ->info ['file ' ] = null ;
396397
397398 foreach (explode ('/ ' , $ path ) as $ dir ) {
398399 if ($ dir !== '' ) {
@@ -412,10 +413,10 @@ public function setPath ($path) {
412413 * Return the url path
413414 */
414415 public function getPath ($ file = false ) {
415- $ path = isset ($ this ->info ['path ' ]) ? implode ('/ ' , $ this ->info ['path ' ]) : '' ;
416+ $ path = isset ($ this ->info ['path ' ]) ? ' / ' . implode ('/ ' , $ this ->info ['path ' ]). ' / ' : '/ ' ;
416417
417418 if ($ file && !empty ($ this ->info ['file ' ])) {
418- $ path .= ' / ' . $ this ->info ['file ' ];
419+ $ path .= $ this ->info ['file ' ];
419420 }
420421
421422 return $ path ;
@@ -515,13 +516,7 @@ private function buildUrl ($maintainCache = false) {
515516 $ url .= $ this ->info ['host ' ];
516517 }
517518
518- if (($ path = $ this ->getPath ())) {
519- $ url .= '/ ' .$ path ;
520- }
521-
522- if (isset ($ this ->info ['file ' ])) {
523- $ url .= '/ ' .$ this ->info ['file ' ];
524- }
519+ $ url .= $ this ->getPath (true );
525520
526521 if (isset ($ this ->info ['query ' ])) {
527522 $ url .= '? ' .http_build_query ($ this ->info ['query ' ]);
@@ -594,14 +589,6 @@ public function getAbsolute ($url) {
594589 return $ this ->getScheme ().':// ' .$ this ->getHost ().$ url ;
595590 }
596591
597- if ($ url [0 ] === '? ' ) {
598- return $ this ->getScheme ().':// ' .$ this ->getHost ().'/ ' .$ this ->getPath ().$ url ;
599- }
600-
601- $ path = $ this ->getPath ();
602- $ path = !$ path ? '/ ' : "/ $ path/ " ;
603-
604- return $ this ->getScheme ().':// ' .$ this ->getHost ().$ path .$ url ;
592+ return $ this ->getScheme ().':// ' .$ this ->getHost ().$ this ->getPath ().$ url ;
605593 }
606594}
607- ?>
0 commit comments