From 1eb64a7a002721f98527bd0acaf526bbf52b571a Mon Sep 17 00:00:00 2001 From: Davis Vaughan Date: Fri, 23 Aug 2024 19:58:44 -0400 Subject: [PATCH] Avoid scary implicit conversion from `sexp` to `bool` (#757) --- src/zip.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/zip.cpp b/src/zip.cpp index acd52cce..eb186d3d 100644 --- a/src/zip.cpp +++ b/src/zip.cpp @@ -2,8 +2,10 @@ #include "rapidxml/rapidxml_print.h" +#include "cpp11/as.hpp" #include "cpp11/function.hpp" #include "cpp11/raws.hpp" +#include "cpp11/sexp.hpp" std::string zip_buffer(const std::string& zip_path, const std::string& file_path) { @@ -19,7 +21,8 @@ std::string zip_buffer(const std::string& zip_path, bool zip_has_file(const std::string& zip_path, const std::string& file_path) { cpp11::function zip_has_file = cpp11::package("readxl")["zip_has_file"]; - return zip_has_file(zip_path, file_path); + cpp11::sexp out = zip_has_file(zip_path, file_path); + return cpp11::as_cpp(out); } std::string xml_print(std::string xml) {