Try to read install info. returns ExtensionInstallMode::UNKNOWN on missing file, and throws on corrupt file.
281314 {
281315 unique_ptr<ExtensionInstallInfo> result;
281316
281317 string hint =
StringUtil::Format(
"Try reinstalling the extension using 'FORCE INSTALL %s;'", extension_name);
281318
281319
281320 if (!fs.FileExists(info_file_path)) {
281321 return make_uniq<ExtensionInstallInfo>();
281322 }
281323
281324 BufferedFileReader file_reader(fs, info_file_path.c_str());
281325 if (!file_reader.Finished()) {
281326 try {
281327 result = BinaryDeserializer::Deserialize<ExtensionInstallInfo>(file_reader);
281328 } catch (std::exception &ex) {
281329 ErrorData error(ex);
281330 throw IOException(
281331 "Failed to read info file for '%s' extension: '%s'.\nA serialization error occurred: '%s'\n%s",
281332 extension_name, info_file_path, error.RawMessage(), hint);
281333 }
281334 }
281335
281336 if (!result) {
281337 throw IOException("Failed to read info file for '%s' extension: '%s'.\nThe file appears to be empty!\n%s",
281338 extension_name, info_file_path, hint);
281339 }
281340
281341 return result;
281342}
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002