80051 : LazyMultiFileList(FileOpener::TryGetClientContext(opener)), fs(fs), path(fs.ExpandPath(path_p, opener)),
80052 opener(opener) {
80053 if (path.empty()) {
80054 finished = true;
80055 return;
80056 }
80057
80058 idx_t last_pos = 0;
80059 for (
idx_t i = 0; i < path.size(); i++) {
80060 if (path[i] == '\\' || path[i] == '/') {
80061 if (i == last_pos) {
80062
80063 last_pos = i + 1;
80064 continue;
80065 }
80066 if (splits.empty()) {
80067 splits.emplace_back(fs, path.substr(0, i));
80068 } else {
80069 splits.emplace_back(fs, path.substr(last_pos, i - last_pos));
80070 }
80071 last_pos = i + 1;
80072 }
80073 }
80074 splits.emplace_back(fs, path.substr(last_pos, path.size() - last_pos));
80075
80076 absolute_path = false;
80077 if (fs.IsPathAbsolute(path)) {
80078
80079 absolute_path = true;
80081 ":")) {
80082
80083 absolute_path = true;
80084 } else if (splits[0].path == "~") {
80085
80086 auto home_directory = fs.GetHomeDirectory(opener);
80087 if (!home_directory.empty()) {
80088 absolute_path = true;
80089 splits[0].path = home_directory;
80090 D_ASSERT(path[0] == '~');
80091 if (!fs.HasGlob(path)) {
80092 expanded_files = fs.FetchFileWithoutGlob(home_directory + path.substr(1), opener, absolute_path);
80093 finished = true;
80094 return;
80095 }
80096 }
80097 }
80098
80099 if (!fs.HasGlob(path)) {
80100
80101 expanded_files = fs.FetchFileWithoutGlob(path, opener, absolute_path);
80102 finished = true;
80103 return;
80104 }
80105 if (absolute_path) {
80106
80107
80108 if (splits.size() > 1) {
80109 expand_directories.emplace(splits[0].path, 1);
80110 }
80111 } else {
80112
80113 Value value;
80114 if (opener && opener->TryGetCurrentSetting("file_search_path", value)) {
80115 auto search_paths_str = value.
ToString();
80117 for (const auto &search_path : search_paths) {
80118 expand_directories.emplace(search_path, 0);
80119 }
80120 }
80121 if (expand_directories.empty()) {
80122 expand_directories.emplace(".", 0, true);
80123 }
80124 }
80125
80126 if (HasMultipleCrawl(splits)) {
80127 throw IOException("Cannot use multiple \'**\' in one path");
80128 }
80129}
vector< OpenFileInfo > expanded_files
The expanded files.
Definition duckdb.cpp:53855
static DUCKDB_API bool Contains(const string &haystack, const string &needle)
Returns true if the needle string exists in the haystack.
Definition duckdb.cpp:109323
static DUCKDB_API vector< string > Split(const string &str, char delimiter)
Split the input string based on newline char.
Definition duckdb.cpp:109734
DUCKDB_API string ToString() const
Convert this value to a string.
Definition duckdb.cpp:133318
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237