Fix #4856 - escape path with backward slash in Labs#4859
Conversation
87e89c0 to
1b74e89
Compare
| const bool is_labs = !args.empty() && (args[0] == "labs"); | ||
| if (is_labs) { | ||
| // Replace backward slashes with forward slashes... cf #4856 | ||
| std::for_each(args.begin(), args.end(), [](auto& s) { | ||
| //std::replace(s.begin(), s.end(), '\\', '/'); | ||
| boost::replace_all(s, "\\", "\\\\"); | ||
| }); | ||
| // fmt::print("Cleaned after slash replacement arguments: {}\n", args); | ||
| } |
There was a problem hiding this comment.
Note: my original idea was to replace all \ with /. I believe that's what ruby does here: https://github.com/ruby/ruby/blob/1f4d4558484b370999954f3ede7e3aa3a3a01ef3/ruby.c#L1698-L1702
I feared this would cause more problems so I've tried something different, trying to escape those \\.
it's not perfect, I suppose some weird stuff like openstudio -e 'puts "hello\nworld"' will more or less work (then again, it also doesn't work on windows with the official ruby.exe so...), but it should fix most issues.
|
CI Results for 1b74e89:
|
shorowit
left a comment
There was a problem hiding this comment.
Tested various CLI commands on both Windows and Linux, labs and standard, and everything worked.
|
@shorowit thanks for testing! |
Pull request overview
labson Windows doesn't correctly process backward slashes #4856Pull Request Author
src/model/test)src/energyplus/Test)src/osversion/VersionTranslator.cpp)Labels:
IDDChangeAPIChangePull Request - Ready for CIso that CI builds your PRReview Checklist
This will not be exhaustively relevant to every PR.