loader.cpp: improved file extension checking, made Upper/LowerStr useful

Instead of forcibly taking the last 4 characters, it now finds the last extension separator (the period) and takes a substr of its location.
Suggestion:
    size_t extension_loc = filename.find_last_of('.');
    if (extension_loc == std::string::npos)
       return FileType::Unknown;
    std::string extension = ToLower(filename.substr(extension_loc)):

Although really, this code should be changed to perform file type checking based on contents rather than extension... but that's not of concern for this PR.