From 7b530efcdd80c33e261a488d58e4c44c6e677885 Mon Sep 17 00:00:00 2001 From: vuule Date: Wed, 9 Mar 2022 12:53:02 -0800 Subject: [PATCH] init the static var normally --- cpp/src/io/utilities/file_io_utilities.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cpp/src/io/utilities/file_io_utilities.cpp b/cpp/src/io/utilities/file_io_utilities.cpp index 15ca64d0f3f..f7e250f1d3f 100644 --- a/cpp/src/io/utilities/file_io_utilities.cpp +++ b/cpp/src/io/utilities/file_io_utilities.cpp @@ -88,14 +88,13 @@ class cufile_shim { void cufile_shim::modify_cufile_json() const { std::string const json_path_env_var = "CUFILE_ENV_PATH_JSON"; - static std::optional tmp_config_dir; - if (not tmp_config_dir.has_value()) { tmp_config_dir = temp_directory{"cudf_cufile_config"}; } + static temp_directory tmp_config_dir{"cudf_cufile_config"}; // Modify the config file based on the policy auto const config_file_path = getenv_or(json_path_env_var, "/etc/cufile.json"); std::ifstream user_config_file(config_file_path); // Modified config file is stored in a temporary directory - auto const cudf_config_path = tmp_config_dir->path() + "cufile.json"; + auto const cudf_config_path = tmp_config_dir.path() + "cufile.json"; std::ofstream cudf_config_file(cudf_config_path); std::string line;