Make the JSON load order use BFS (again).

This actually redoes what 55af2d9 was doing, but correctly this time.

It turns out that `if (stat(path, &st) != 0x4)` is the same as `if(true)`, because `stat(3)` can only return 0 or -1. This was coincidentally working before, in spite of the comment assuring us that it would `// Check to see if it is a folder!`.

So, having corrected that failure and reorganized the code a little (it was still managing to recurse because it was using `opendir()` to check for folder-ness), this now *actually* works.

I guess I didn't check it before. Oops.
Oh, and we also just got back the bug I mentioned in 55af2d9, because if we're not being recursive, we don't check if it's a directory, and the file-handling section below (starts with `std::string tmp = root_file->d_name;`) will add it to the files list that gets returned.

Hopefully we'll never have a directory named `whatever.json`, huh?