@@ -172,14 +172,19 @@ protected function getAppDir() : string
172172 }
173173
174174 /**
175- * Get dir root.
175+ * Get dynamic root path .
176176 *
177177 * @access protected
178+ * @param string $sub
178179 * @return string
179180 */
180- protected function getRoot () : string
181+ protected function getRoot (? string $ sub = null ) : string
181182 {
182- return dirname ($ this ->getAppDir ());
183+ $ path = dirname ($ this ->getAppDir ());
184+ if ( $ sub ) {
185+ $ path .= "/ {$ sub }" ;
186+ }
187+ return $ this ->formatPath ($ path );
183188 }
184189
185190 /**
@@ -438,11 +443,14 @@ protected function getViewExtension() : string
438443 * @access protected
439444 * @return string
440445 */
441- protected function getBaseUrl () : string
446+ protected function getBaseUrl (? string $ sub = null ) : string
442447 {
443448 $ url = Server::getBaseUrl ();
444- $ route = $ this ->getBaseRoute ();
445- return $ this ->untrailingSlash ("{$ url }/ {$ route }" );
449+ $ url = "{$ url }/ {$ this ->getBaseRoute ()}" ;
450+ if ( $ sub ) {
451+ $ url .= "/ {$ sub }" ;
452+ }
453+ return $ this ->formatPath ($ url , true );
446454 }
447455
448456 /**
@@ -469,6 +477,20 @@ protected function getAssetPath() : string
469477 return $ this ->formatPath ($ path , true );
470478 }
471479
480+ /**
481+ * Get public url.
482+ *
483+ * @access protected
484+ * @param string $path
485+ * @return string
486+ */
487+ protected function getPublicUrl (?string $ path = null ) : string
488+ {
489+ return $ this ->formatPath (
490+ "{$ this ->getBaseUrl ()}/public/ {$ path }"
491+ );
492+ }
493+
472494 /**
473495 * Get front upload url.
474496 *
@@ -540,7 +562,9 @@ protected function getAdminPath(?string $path = null) : string
540562 */
541563 protected function getPublicPath (?string $ path = null ) : string
542564 {
543- return "{$ this ->getRoot ()}/public/ {$ path }" ;
565+ return $ this ->formatPath (
566+ "{$ this ->getRoot ()}/public/ {$ path }"
567+ );
544568 }
545569
546570 /**
0 commit comments