How to get custom folder

I want to get the “custom” folder.
After some research, I found two solutions:

  1. Make the $dolibarr_main_document_root_alt variable global.
  2. Use the $conf->file->dol_document_root[‘alt0’] variable.

Is it possible that there isn’t a more “explicit” variable (as in the case of DOL_DOCUMENT_ROOT)?

Why do you want to get the custom folder? where do you want to get it? inside Dolbiarr, outside? what protocol, …?

In the conf.php file you can set the custom folder (where all the custom modules are) using the
$dolibarr_main_document_root_alt
variable.
Writing my custom code I want to get this setting.