ScriptCase Variable that contains the directory that SC is being run from

Is there is a way to find the ScriptCase Variable that contains the directory that SC is being run from? I could have sworn I’ve seen it but I can’t find it now.

Or maybe it’s a php function???

Thanks

Look into the $_SERVER variable. A quick view is var_dump($_SERVER)

Check here:
http://stackoverflow.com/questions/4622686/php-using-server-to-return-the-current-directory-regardless-of-nice-urls

DIR should work as well
http://php.net/manual/en/language.constants.predefined.php

Too much care with this. Take a look to this file example using the following structure.

/project/foo.php
/project/includes/bar.php

bar.php content:


<?php
function currentPath();
    return __DIR__;
}

foo.php content:


<?php
include "./includes/bar.php";

$path = currentPath();
echo $path;

So… in you execute foo.php file, the result will be project/includes/ instead of project/

… well currentPath() is in bar.php which is in project/includes so I can (kinda) see why that happened.

Why not use “echo DIR;” directly in foo.php?