Files
test2/source/blender/asset_system/intern/asset_essentials_library.cc
Brecht Van Lommel e0ff7731e0 Core: make BKE_appdir functions thread safe, using optional<string>
The static variables can cause the wrong path to be used, for example
when asset indexing in a thread affects loading toolbar icons.

Fix #117416: toolbar icon randomly missing

Pull Request: https://projects.blender.org/blender/blender/pulls/117419
2024-01-23 18:38:15 +01:00

28 lines
628 B
C++

/* SPDX-FileCopyrightText: 2023 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
/** \file
* \ingroup asset_system
*/
#include "BLI_path_util.h"
#include "BKE_appdir.hh"
#include "AS_essentials_library.hh"
namespace blender::asset_system {
StringRefNull essentials_directory_path()
{
static std::string path = []() {
const std::optional<std::string> datafiles_path = BKE_appdir_folder_id(BLENDER_DATAFILES,
"assets");
return datafiles_path.value_or("");
}();
return path;
}
} // namespace blender::asset_system