File::getCurrentWorkingDirectory doesn't work when CWD is set from Xcode scheme options (OSX / posix)

Xcode allows to set the CWD from its scheme options, but it will just set the PWD environment variable, and if you set a custom directory there, and execute File::getCurrentWorkingDirectory it will return an empty File() because getcwd will return nullptr.

I’ve extended the function (for posix) to take into account the PWD env variable when getcwd fails:

File File::getCurrentWorkingDirectory()
{
    HeapBlock<char> heapBuffer;

    char localBuffer[1024];
    auto cwd = getcwd (localBuffer, sizeof (localBuffer) - 1);
    size_t bufferSize = 4096;

    while (cwd == nullptr && errno == ERANGE)
    {
        heapBuffer.malloc (bufferSize);
        cwd = getcwd (heapBuffer, bufferSize - 1);
        bufferSize += 1024;
    }

    if (cwd == nullptr)
        return File (CharPointer_UTF8 (getenv ("PWD")));

    return File (CharPointer_UTF8 (cwd));
}

Maybe this is something that could be fixed ?