UTF8 paths are now properly handled on windows.

This commit is contained in:
Mr_Goldberg 2021-04-25 12:44:41 -04:00
parent b8eae2b709
commit 51702b898e
No known key found for this signature in database
GPG key ID: 8597D87419DEF278
5 changed files with 147 additions and 96 deletions

View file

@ -31,7 +31,7 @@ static void consume_bom(std::ifstream &input)
static void load_custom_broadcasts(std::string broadcasts_filepath, std::set<uint32> &custom_broadcasts)
{
PRINT_DEBUG("Broadcasts file path: %s\n", broadcasts_filepath.c_str());
std::ifstream broadcasts_file(broadcasts_filepath);
std::ifstream broadcasts_file(utf8_decode(broadcasts_filepath));
consume_bom(broadcasts_file);
if (broadcasts_file.is_open()) {
std::string line;
@ -69,7 +69,7 @@ static void load_gamecontroller_settings(Settings *settings)
std::transform(action_set_name.begin(), action_set_name.end(), action_set_name.begin(),[](unsigned char c){ return std::toupper(c); });
std::string controller_config_path = path + PATH_SEPARATOR + p;
std::ifstream input( controller_config_path );
std::ifstream input( utf8_decode(controller_config_path) );
if (input.is_open()) {
consume_bom(input);
std::map<std::string, std::pair<std::set<std::string>, std::string>> button_pairs;
@ -307,7 +307,7 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
{
std::string dlc_config_path = Local_Storage::get_game_settings_path() + "DLC.txt";
std::ifstream input( dlc_config_path );
std::ifstream input( utf8_decode(dlc_config_path) );
if (input.is_open()) {
consume_bom(input);
settings_client->unlockAllDLC(false);
@ -349,7 +349,7 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
{
std::string dlc_config_path = Local_Storage::get_game_settings_path() + "app_paths.txt";
std::ifstream input( dlc_config_path );
std::ifstream input( utf8_decode(dlc_config_path) );
if (input.is_open()) {
consume_bom(input);
@ -384,7 +384,7 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
{
std::string dlc_config_path = Local_Storage::get_game_settings_path() + "leaderboards.txt";
std::ifstream input( dlc_config_path );
std::ifstream input( utf8_decode(dlc_config_path) );
if (input.is_open()) {
consume_bom(input);
settings_client->setCreateUnknownLeaderboards(false);
@ -426,7 +426,7 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
{
std::string stats_config_path = Local_Storage::get_game_settings_path() + "stats.txt";
std::ifstream input( stats_config_path );
std::ifstream input( utf8_decode(stats_config_path) );
if (input.is_open()) {
consume_bom(input);
for( std::string line; getline( input, line ); ) {
@ -491,7 +491,7 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
{
std::string depots_config_path = Local_Storage::get_game_settings_path() + "depots.txt";
std::ifstream input( depots_config_path );
std::ifstream input( utf8_decode(depots_config_path) );
if (input.is_open()) {
consume_bom(input);
for( std::string line; getline( input, line ); ) {
@ -513,7 +513,7 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
{
std::string depots_config_path = Local_Storage::get_game_settings_path() + "subscribed_groups.txt";
std::ifstream input( depots_config_path );
std::ifstream input( utf8_decode(depots_config_path) );
if (input.is_open()) {
consume_bom(input);
for( std::string line; getline( input, line ); ) {
@ -553,4 +553,4 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
*local_storage_out = local_storage;
return appid;
}
}