diff --git a/SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp b/SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp index 98a17f73fd..b144b49a11 100644 --- a/SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp +++ b/SofaGLFW/src/SofaGLFW/SofaGLFWBaseGUI.cpp @@ -47,6 +47,7 @@ #include #include #include +#include using namespace sofa; using namespace sofa::gui::common; @@ -213,13 +214,16 @@ void SofaGLFWBaseGUI::restoreCamera(BaseCamera::SPtr camera) if (camera) { const std::string viewFileName = this->getFilename() + std::string(this->getCameraFileExtension()); - if (camera->importParametersFromFile(viewFileName)) + if (helper::system::FileSystem::isFile(viewFileName)) { - msg_info("GUI") << "Current camera parameters have been imported from " << viewFileName << " ."; - } - else - { - msg_error("GUI") << "Could not import camera parameters from " << viewFileName << " ."; + if (camera->importParametersFromFile(viewFileName)) + { + msg_info("GUI") << "Current camera parameters have been imported from " << viewFileName << " ."; + } + else + { + msg_error("GUI") << "Could not import camera parameters from " << viewFileName << " ."; + } } } }