So in my general config file I've defined an environmental variable called basePath (as per the Environment-Specific Variables documentation). I'm using the getcwd() function to get the working directory.
return array( '*' => array( 'environmentVariables' => array( 'basePath' => getcwd(), ) ), );
I'm using this for a few reasons:
I work in an environment where many people can be working on the same project at the same time. So their local basePath is always different.
My different siteUrls for my setup use trailing locales in the url:
'siteUrl' => array( 'en' => 'http://www.website.com/', 'fi' => 'http://www.website.com/fi/' ). So when it comes to targeting environment-specific locales, things get messy.
$_SERVER['DOCUMENT_ROOT']is ok locally, but fails on a live server.
So my problem is when using
getcwd(), the locale is included in path. Is there a way to trim this out dynamically?
Or is there a way to strip out the current locale from this path on-the-fly?
Maybe there is a more reliable way to get the working directory?