|
5 | 5 | #include "duckdb/common/multi_file_reader.hpp" |
6 | 6 | #include "duckdb/function/table_function.hpp" |
7 | 7 | #include "duckdb/main/extension_util.hpp" |
| 8 | +#include "duckdb/common/file_system.hpp" |
8 | 9 | #include "vortex_extension.hpp" |
9 | 10 |
|
10 | | -#if __has_include(<filesystem>) |
11 | | - #include <filesystem> |
12 | | - namespace fs = std::filesystem; |
13 | | -#elif __has_include(<experimental/filesystem>) |
14 | | - #include <experimental/filesystem> |
15 | | - namespace fs = std::experimental::filesystem; |
16 | | -#else |
17 | | - #error "No filesystem support available" |
18 | | -#endif |
19 | 11 | #include <regex> |
20 | 12 |
|
21 | 13 | #include "vortex_common.hpp" |
@@ -159,26 +151,22 @@ static void ExtractVortexSchema(const vx_dtype *file_dtype, vector<LogicalType> |
159 | 151 | } |
160 | 152 | } |
161 | 153 |
|
162 | | -const std::regex schema_prefix = std::regex("^[^/]*:\\/\\/.*$"); |
| 154 | +const std::regex schema_prefix = std::regex("^[^/]*:\\/\\/.*$"); |
163 | 155 |
|
164 | 156 | std::string EnsureFileProtocol(const std::string &path) { |
165 | 157 | // Check if the path has a schema, if not prepend the file:// schema |
166 | 158 | if (std::regex_match(path, schema_prefix)) { |
167 | | - return path; |
| 159 | + return path; |
168 | 160 | } |
169 | 161 |
|
170 | | - auto absolute_path = path; |
171 | 162 | const std::string prefix = "file://"; |
172 | 163 |
|
173 | | - fs::path p = absolute_path; |
174 | | - if (!p.is_absolute()) { |
175 | | - try { |
176 | | - absolute_path = absolute(p).string(); |
177 | | - } catch (const std::exception &e) { |
178 | | - throw InternalException(std::string("Error making path absolute: ") + e.what()); |
179 | | - } |
| 164 | + auto fs = FileSystem::CreateLocal(); |
| 165 | + if (fs->IsPathAbsolute(path)) { |
| 166 | + return path; |
180 | 167 | } |
181 | 168 |
|
| 169 | + const auto absolute_path = fs->JoinPath(fs->GetWorkingDirectory(), path); |
182 | 170 | return prefix + absolute_path; |
183 | 171 | } |
184 | 172 |
|
|
0 commit comments