Open-PupilEXT
Open-PupilEXT copied to clipboard
Stereo calibration file cannot be saved on windows if whitespace in path
If the user name of the working system has a space, saving the log files does not work. A current workaround is to save the log file directly on the hard disk like 'c:/' or similar.
The source of the issue and workaround was mentioned in this post https://github.com/openPupil/Open-PupilEXT/discussions/6
Hi Babak,
from what i see one could use the QT function QDir::toNativeSeparators
to normalize the path with whitespaces. This would probably solve this issue as well as #6 (the replace
could be removed). Does this issue also occur for saving images in a path with whitespaces? For writing images, the path is initialized using QDir(...)
, which probably implicitly applies toNativeSeparators
so thats maybe the reason it doesn't happen there.
I could write a short pull request for this, but wouldn't be able to test the code myself as i don't have the building system setup.
Best regards
Dear Moritz, thanks for the suggestion! Sorry, I have just realised that I made a mistake in the title of the issue. Saving the log files should be fine but I will check to be sure. The issue is related to saving the stereo calibration file on windows as discussed here https://github.com/openPupil/Open-PupilEXT/discussions/6. I will change the title of this issue.
I will check by the end of the week whether saving log files or images is also affected if there is a space in the path.
Hi Moritz, saving images as well as logs with a whitespace in path works fine. I tested it in both, single and stereo camera mode on windows.
Saving the calib file in stereo mode does not work with a whitespace in path. However, saving the calib file in single camera mode works fine. This should be related to filename.replace(" ", "");
in line 232 of /src/subwindows/stereoCameraCalibrationView.cpp
void StereoCameraCalibrationView::onSaveClick() {
QString filename = QFileDialog::getSaveFileName(this, tr("Save Calibration File"), "", tr("XML files (*.xml)"));
if(!filename.isEmpty()) {
filename.replace(" ", "");
QFileInfo fileInfo(filename);
// check if filename has extension, else append xml to it
if(fileInfo.suffix().isEmpty()) {
filename = filename + ".xml";
}
std::cout<<"Saving calibration file to settings directory: "<< filename.toStdString() <<std::endl;
calibrationWorker->saveToFile(filename.toStdString().c_str());
}
}
Do you want to write a short pull request for that issue?