Skip to content

Two blackslashes on json output file #1253

@exphck1337

Description

@exphck1337

It has a small bug in the library, recognizing two backslashes in the output(which should only be one in this case):

// Bug example:
bool write_default_config() {
  auto default_config_file = std::ofstream(config::get_config_file_full_dir());

  if (default_config_file.is_open()) {
    json default_config = {{"steam_path", "C:\\Program Files (x86)\\Steam"}, // I need to use \\ because it is a backslash character, using only \ the compiler doesn't recognize as a backslash character
                     {"clear_appcache", true},
                     {"execute_bcdedit", true},
                     {"execute_sfc", true},
                     {"repair_steamservice", true}};

    default_config_file << default_config.dump(10) << std::endl;
    default_config_file.close();
    return true;
  }
  return false;
}

Output in .json file:

{
          "clear_appcache": true,
          "execute_bcdedit": true,
          "execute_sfc": true,
          "repair_steamservice": true,
          "steam_path": "C:\\Program Files (x86)\\Steam"
}

Correct output should be:

{
          "clear_appcache": true,
          "execute_bcdedit": true,
          "execute_sfc": true,
          "repair_steamservice": true,
          "steam_path": "C:\Program Files (x86)\Steam"
}

Is there any way to show only one backslash instead of two on output?

Metadata

Metadata

Assignees

No one assigned

    Labels

    solution: invalidthe issue is not related to the library

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions