loader.cpp: improved file extension checking, made Upper/LowerStr useful, moved string_util into Common namespace

Instead of forcibly taking the last 4 characters, it now finds the last extension separator (the period) and takes a substr of its location.