Skip to content

Subdoc doc generation doesn't work on windows #455

@PeterChou1

Description

@PeterChou1

The issues lies in subdoc_main.cc here

you need to also canonicalize the input_path to use / instead of \ too it should look something like this:

for (const std::string& input_path : paths) {
    bool found = false;

    std::string input_path_replace = input_path;
    std::replace(input_path_replace.begin(), input_path_replace.end(), '\\', '/');

    for (const std::string& s : comp_db_files) {
      // Canonicalize the path to use `/` instead of `\`.
      auto canonical_path = std::string(s);
      std::replace(canonical_path.begin(), canonical_path.end(), '\\', '/');

      if (canonical_path.find(input_path_replace) == std::string::npos) {
        continue;
      }
      run_against_files.push(sus::move(canonical_path));
      found = true;
    }
    if (!found) {
      fmt::println(stderr, "Unknown file, not in compiledb: {}", input_path);
      return 1;
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions