Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stereo calibration file cannot be saved on windows if whitespace in path #42

Open
BZandi opened this issue Jan 22, 2023 · 3 comments
Open

Comments

@BZandi
Copy link
Member

BZandi commented Jan 22, 2023

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 #6

@lodemo
Copy link
Member

lodemo commented Jan 22, 2023

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

@BZandi
Copy link
Member Author

BZandi commented Jan 23, 2023

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 #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.

@BZandi BZandi changed the title Log files (CSV) cannot be saved on windows Stereo calibration file cannot be saved on windows Jan 23, 2023
@BZandi BZandi changed the title Stereo calibration file cannot be saved on windows Stereo calibration file cannot be saved on windows if whitespace in path Jan 23, 2023
@BZandi
Copy link
Member Author

BZandi commented Jan 27, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants