MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / addDBDirToFileSearchPath

Method addDBDirToFileSearchPath

src/main/client_context.cpp:216–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216void ClientContext::addDBDirToFileSearchPath(const std::string& dbPath) {
217 // Skip remote paths (e.g. s3://, https://)
218 if (dbPath.find("://") != std::string::npos) {
219 return;
220 }
221 if (dbPath.find_first_of("/\\") == std::string::npos) {
222 return;
223 }
224 const auto expandedPath = storage::StorageUtils::expandPath(this, dbPath);
225 const auto slashPos = expandedPath.find_last_of("/\\");
226 if (slashPos == std::string::npos) {
227 return;
228 }
229 std::string dirPath = expandedPath.substr(0, slashPos);
230 if (dirPath.empty()) {
231 dirPath = expandedPath[slashPos] == '\\' ? "\\" : "/";
232 } else {
233 dirPath = std::filesystem::absolute(dirPath).lexically_normal().string();
234 }
235 // Prepend to fileSearchPath if not already present
236 auto& fileSearchPath = clientConfig.fileSearchPath;
237 if (!fileSearchPath.empty()) {
238 const auto searchPaths = StringUtils::split(fileSearchPath, ",");
239 if (std::find(searchPaths.begin(), searchPaths.end(), dirPath) != searchPaths.end()) {
240 return;
241 }
242 fileSearchPath = std::format("{},{}", dirPath, fileSearchPath);
243 } else {
244 fileSearchPath = dirPath;
245 }
246}
247
248std::string ClientContext::getEnvVariable(const std::string& name) {
249#if defined(_WIN32)

Callers 3

TESTFunction · 0.80
executeInternalMethod · 0.80
initMembersMethod · 0.80

Calls 4

findMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TESTFunction · 0.64