TerraForge3D  2.3.1
3D Terrain And Landscape Generator

◆ LoadDownloadedTextureDatabaseJ()

nlohmann::json TextureStore::LoadDownloadedTextureDatabaseJ ( )
private

Definition at line 131 of file TextureStore.cpp.

132{
133 if(!FileExists(GetExecutableDir() + PATH_SEPARATOR "Data" PATH_SEPARATOR "configs" PATH_SEPARATOR "texture_database_downloaded.terr3d"))
134 {
135 Log("No Textures downloaded yet");
136 return nlohmann::json();
137 }
138
139 bool tmp = false;
140 std::string tmpStr = ReadShaderSourceFile(GetExecutableDir() +
141 PATH_SEPARATOR "Data" PATH_SEPARATOR "configs" PATH_SEPARATOR
142 "texture_database_downloaded.terr3d", &tmp);
143
144 if(tmp == false)
145 {
146 Log("Failed to load downloaded texture database from file");
147 return nlohmann::json();
148 }
149
150 nlohmann::json tmpJ;
151
152 try
153 {
154 tmpJ = nlohmann::json::parse(tmpStr);
155 }
156
158 {
159 Log("Failed to parse downloaded texture database from file");
160 return nlohmann::json();
161 }
162
163 return tmpJ;
164}
static JSON_HEDLEY_WARN_UNUSED_RESULT basic_json parse(InputType &&i, const parser_callback_t cb=nullptr, const bool allow_exceptions=true, const bool ignore_comments=false)
deserialize from a compatible input
Definition: json.hpp:24605
a class to store JSON values
Definition: json.hpp:17860
exception indicating a parse error
Definition: json.hpp:2788
basic_json<> json
default JSON class
Definition: json.hpp:3411