From f6e27d411bbd52e1c48e6c6f623b26a38b4e0e6f Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Tue, 4 May 2021 13:07:12 +0200 Subject: [PATCH] fix for windows --- Installation/include/CGAL/config.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index 9ed1f135065..25ffc1b1394 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -745,9 +745,12 @@ namespace CGAL { inline std::string data_file_path(const std::string& filename) { const char* cgal_dir=nullptr; - + #ifdef _MSC_VER - _dupenv_s( &cgal_dir, nullptr, "CGAL_DATA_DIR"); + char* cgal_dir_windows=nullptr; + _dupenv_s( &cgal_dir_windows, nullptr, "CGAL_DATA_DIR"); + if (cgal_dir_windows!=nullptr) + { cgal_dir=cgal_dir_windows; } #else cgal_dir=getenv("CGAL_DATA_DIR"); #endif @@ -775,8 +778,8 @@ inline std::string data_file_path(const std::string& filename) } #ifdef _MSC_VER - if (cgal_dir!=nullptr) - { free(cgal_dir); } + if (cgal_dir_windows!=nullptr) + { free(cgal_dir_windows); } #endif return res;