File::getSpecialLocation, storage directory for Android?

I'm currently writing files directly to a folder called /sdcard/ on my phone, but I'm wary of using fixed paths like this. Is there a way to get the phone's storage directory?

After some searching around it seems that I can call getenv("EXTERNAL_STORAGE") to retrieve the primary storage folder.