443403 {
443404
443405 temp_file.reset();
443406
443407 auto &fs = FileSystem::GetFileSystem(db);
443408 if (!temp_directory.empty()) {
443409 bool delete_directory = created_directory;
443410 vector<string> files_to_delete;
443411 if (!created_directory) {
443412 bool deleted_everything = true;
443413 fs.ListFiles(temp_directory, [&](const string &path, bool isdir) {
443414 if (isdir) {
443415 deleted_everything = false;
443416 return;
443417 }
443419 deleted_everything = false;
443420 return;
443421 }
443422 files_to_delete.push_back(path);
443423 });
443424 }
443425 if (delete_directory) {
443426
443427 fs.RemoveDirectory(temp_directory);
443428 } else {
443429 vector<string> full_path_files_to_delete;
443430 full_path_files_to_delete.reserve(files_to_delete.size());
443431 for (auto &file : files_to_delete) {
static DUCKDB_API bool StartsWith(string str, string prefix)
Returns true if the target string starts with the given prefix.
Definition duckdb.cpp:109377