Suggested by @MarcoFalke after #14627 and possibly #14420. We should warn if an unrecognised/incorrect section is present in bitcoin.conf. i.e `[testnet]` is present instead of `[test]`.
{
    LOCK(csPathCached);
    fs::path &path = fNetSpecific ? g_blocks_path_cache_net_specific : g_blocks_path_cached;
    
    
    if (!path.empty())
        return path;
    if (gArgs.IsArgSet("-blocksdir")) {
        path = fs::system_complete(gArgs.GetArg("-blocksdir", ""));
        if (!fs::is_directory(path)) {
            path = "";
            return path;
        }
    } else {
        path = GetDataDir(false);
    }
    if (fNetSpecific)
        path /= BaseParams().DataDir();
    path /= "blocks";
    fs::create_directories(path);
    return path;
}
const fs::path &GetDataDir(bool fNetSpecific)