21using blender::string_search::RecentCache;
42 storage.cache.logical_time_by_str.add_overwrite(chosen_str,
storage.logical_clock);
59 if (!user_config_dir.has_value()) {
65 return std::string(filepath);
81 if (
storage.cache.logical_time_by_str.is_empty() && !
BLI_exists((*path).c_str())) {
86 for (
const auto item :
storage.cache.logical_time_by_str.items()) {
87 values.
append({item.value, item.key});
89 std::ranges::sort(values);
91 fstream file(*path, std::ios::out);
92 for (
const auto &item : values) {
93 file.write(item.second.data(), item.second.size());
111 storage.cache.logical_time_by_str.clear();
115 while (std::getline(file, line)) {
116 storage.cache.logical_time_by_str.add_overwrite(line,
storage.logical_clock);
#define BLENDER_RECENT_SEARCHES_FILE
File and directory operations.
#define BLI_path_join(...)
void append(const T &value)
#define storage(slot, qualifiers)
static RecentCacheStorage & get_recent_cache_storage()
void add_recent_search(StringRef chosen_str)
void read_recent_searches_file()
void write_recent_searches_file()
static std::optional< std::string > get_recent_searches_file_path()
const blender::string_search::RecentCache * get_recent_cache_or_null()
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
std::optional< std::string > BKE_appdir_folder_id_create(int folder_id, const char *subfolder) ATTR_WARN_UNUSED_RESULT
bool BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
@ USER_FLAG_RECENT_SEARCHES_DISABLE