Reduce scope of temp camera file
This commit is contained in:
5
api.cpp
5
api.cpp
@@ -131,6 +131,9 @@ class Context {
|
||||
|
||||
val captureImageAsFile() {
|
||||
return gpp_rethrow([=]() {
|
||||
auto &file = get_file();
|
||||
|
||||
{
|
||||
struct TempCameraFile {
|
||||
Camera &camera;
|
||||
GPContext &context;
|
||||
@@ -152,10 +155,10 @@ class Context {
|
||||
gpp_try(gp_camera_capture(camera.get(), GP_CAPTURE_IMAGE,
|
||||
&camera_file.path, context.get()));
|
||||
|
||||
auto &file = get_file();
|
||||
gpp_try(gp_camera_file_get(camera.get(), camera_file.path.folder,
|
||||
camera_file.path.name, GP_FILE_TYPE_NORMAL,
|
||||
&file, context.get()));
|
||||
}
|
||||
|
||||
gpp_try(gp_file_set_name(&file, "image."));
|
||||
gpp_try(gp_file_adjust_name_for_mime_type(&file));
|
||||
|
||||
Reference in New Issue
Block a user