How to get Magento 2 base directory programmatically

See also other filesystem topics: