Description
On Windows machines, the code for reading the input files works, but that path is not properly handled with the implementation of the if/else statements:
if (argc == 3) {
output_file_name = argv[2];
} else {
// If output file is not provided, default is <path to .json>+"output.csv"
std::size_t end_of_path = input_file_name.rfind("/");
if (end_of_path == std::string::npos) {
end_of_path = input_file_name.rfind("\\"); // For Windows paths (?) **<-- will find input file**
// If <path to .json> is still not found, use current directory
if (end_of_path == std::string::npos) {
output_file_path = ".";
}
} else {
output_file_path = input_file_name.substr(0, end_of_path); **<-- skips because if {} was evaluated (missing path)**
}
output_file_name = output_file_path + "/output.csv";
std::cout << "[svzerodsolver] Output will be written to '"
<< output_file_name << "'." << std::endl;
;
}
Reproduction
Any code that relies on svzerodsolver.cpp implementation (originally found from 0d simulations in svVascularize gui).
OS: Windows 11
Expected behavior
Adding one short else statement fixed this issue, allowing the output file to save properly on my machine:
if (end_of_path == std::string::npos) {
end_of_path = input_file_name.rfind("\\");
// If <path to .json> is still not found, use current directory
if (end_of_path == std::string::npos) {
output_file_path = ".";
}
**else {
output_file_path = input_file_name.substr(0, end_of_path); <-- new code
}**
}
else {
output_file_path = input_file_name.substr(0, end_of_path);
}
Additional context
No response
Code of Conduct
Description
On Windows machines, the code for reading the input files works, but that path is not properly handled with the implementation of the if/else statements:
if (argc == 3) {
output_file_name = argv[2];
} else {
// If output file is not provided, default is <path to .json>+"output.csv"
std::size_t end_of_path = input_file_name.rfind("/");
}
Reproduction
Any code that relies on svzerodsolver.cpp implementation (originally found from 0d simulations in svVascularize gui).
OS: Windows 11
Expected behavior
Adding one short else statement fixed this issue, allowing the output file to save properly on my machine:
Additional context
No response
Code of Conduct