Skip to content

Commit

Permalink
Fix line ends on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquev6 committed Oct 24, 2023
1 parent 694f298 commit f177413
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/distribute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,11 @@ jobs:

- name: Run lincs
run: lincs --help
- name: Run lincs
run: lincs generate classification-problem 3 2
- run: lincs generate classification-problem 3 2 --output-problem problem.yml
- run: lincs generate classification-model problem.yml --output-model model.yml
- run: lincs generate classified-alternatives problem.yml model.yml 100 --output-alternatives learning-set.csv
- run: lincs learn classification-model problem.yml learning-set.csv --output-model learned-model.yml
- run: lincs classification-accuracy problem.yml learned-model.yml learning-set.csv

publish:
runs-on: ubuntu-latest
Expand Down
10 changes: 9 additions & 1 deletion lincs/liblincs/io/alternatives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ void Alternatives::dump(const Problem& problem, std::ostream& os) const {
const unsigned criteria_count = problem.criteria.size();
const unsigned alternatives_count = alternatives.size();

rapidcsv::Document doc;
rapidcsv::SeparatorParams separator_params;
separator_params.mHasCR = false; // Fix line ends on Windows (without this line, they are "\r\r\n")

rapidcsv::Document doc(
std::string(),
rapidcsv::LabelParams(),
separator_params,
rapidcsv::ConverterParams(),
rapidcsv::LineReaderParams());

doc.SetColumnName(0, "name");
for (unsigned criterion_index = 0; criterion_index != criteria_count; ++criterion_index) {
Expand Down

0 comments on commit f177413

Please sign in to comment.