Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions c/driver_manager/adbc_driver_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,13 @@ ADBC_EXPORT std::filesystem::path InternalAdbcUserConfigDir() {
std::filesystem::path dir(std::move(wpath));
if (!dir.empty()) {
config_dir = std::filesystem::path(dir);
config_dir /= "ADBC/Drivers";
config_dir /= "ADBC";
}
#elif defined(__APPLE__)
auto dir = std::getenv("HOME");
if (dir) {
config_dir = std::filesystem::path(dir);
config_dir /= "Library/Application Support/ADBC/Drivers";
config_dir /= "Library/Application Support/ADBC";
}
#elif defined(__linux__)
auto dir = std::getenv("XDG_CONFIG_HOME");
Expand All @@ -324,7 +324,7 @@ ADBC_EXPORT std::filesystem::path InternalAdbcUserConfigDir() {
}

if (!config_dir.empty()) {
config_dir = config_dir / "adbc" / "drivers";
config_dir = config_dir / "adbc";
}
#endif // defined(_WIN32)

Expand Down
11 changes: 9 additions & 2 deletions c/driver_manager/adbc_driver_manager_driver_loading.cc
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,12 @@ SearchPaths GetEnvPaths(const char_type* env_var) {
return paths;
}

#if defined(_WIN32) || defined(__APPLE__)
static constexpr const char* kDriversSubdir = "Drivers";
#else
static constexpr const char* kDriversSubdir = "drivers";
#endif

SearchPaths GetSearchPaths(const AdbcLoadFlags levels) {
SearchPaths paths;
if (levels & ADBC_LOAD_FLAG_SEARCH_ENV) {
Expand All @@ -279,7 +285,7 @@ SearchPaths GetSearchPaths(const AdbcLoadFlags levels) {

if (levels & ADBC_LOAD_FLAG_SEARCH_USER) {
// Check the user configuration directory
std::filesystem::path user_config_dir = InternalAdbcUserConfigDir();
std::filesystem::path user_config_dir = InternalAdbcUserConfigDir() / kDriversSubdir;
if (!user_config_dir.empty() && std::filesystem::exists(user_config_dir)) {
paths.emplace_back(SearchPathSource::kUser, std::move(user_config_dir));
} else {
Expand Down Expand Up @@ -614,7 +620,8 @@ AdbcStatusCode ManagedLibrary::FindDriver(
auto status = SearchPathsForDriver(driver_path, more_search_paths, info, error);
if (status == ADBC_STATUS_NOT_FOUND) {
if (!(load_options & ADBC_LOAD_FLAG_SEARCH_USER)) {
std::filesystem::path user_config_dir = InternalAdbcUserConfigDir();
std::filesystem::path user_config_dir =
InternalAdbcUserConfigDir() / kDriversSubdir;
std::string message = "user config dir ";
message += user_config_dir.string();
message += " (enable ADBC_LOAD_FLAG_SEARCH_USER)";
Expand Down
2 changes: 1 addition & 1 deletion c/driver_manager/adbc_driver_manager_profiles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ static SearchPaths GetProfileSearchPaths(const char* additional_search_path_list
const char* profiles_dir = "profiles";
#endif // defined(_WIN32)

auto user_dir = InternalAdbcUserConfigDir().parent_path() / profiles_dir;
auto user_dir = InternalAdbcUserConfigDir() / profiles_dir;
search_paths.emplace_back(SearchPathSource::kUser, user_dir);
return search_paths;
}
Expand Down
6 changes: 5 additions & 1 deletion c/driver_manager/adbc_driver_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,11 @@ TEST_F(DriverManifest, LoadUserLevelManifest) {
ADBC_LOAD_FLAG_DEFAULT, nullptr, &driver, &error),
Not(IsOkStatus(&error)));

auto user_config_dir = InternalAdbcUserConfigDir();
#if defined(_WIN32) || defined(__APPLE__)
auto user_config_dir = InternalAdbcUserConfigDir() / "Drivers";
#else
auto user_config_dir = InternalAdbcUserConfigDir() / "drivers";
Comment thread
zeroshade marked this conversation as resolved.
#endif
bool created = false;
if (!std::filesystem::exists(user_config_dir)) {
ASSERT_TRUE(std::filesystem::create_directories(user_config_dir));
Expand Down
6 changes: 3 additions & 3 deletions go/adbc/drivermgr/adbc_driver_manager.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions go/adbc/drivermgr/adbc_driver_manager_driver_loading.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/adbc/drivermgr/adbc_driver_manager_profiles.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading