lidavidm commented on code in PR #2918:
URL: https://github.com/apache/arrow-adbc/pull/2918#discussion_r2153762988
##########
c/driver_manager/adbc_driver_manager.cc:
##########
@@ -114,7 +128,228 @@ struct OwnedError {
}
};
+std::filesystem::path UserConfigDir() {
+ std::filesystem::path config_dir;
+#if defined(_WIN32)
+ size_t required_size;
+ _wgetenv_s(&required_size, NULL, 0, L"AppData");
+ if (required_size == 0) {
+ return config_dir;
+ }
+
+ std::wstring app_data_value;
+ app_data_value.resize(required_size);
+ _wgetenv_s(&required_size, app_data_value.data(), required_size, L"AppData");
+ std::filesystem::path dir(app_data_value);
+ if (!dir.empty()) {
+ config_dir = std::filesystem::path(dir);
+ config_dir /= "ADBC/drivers";
+ }
+#elif defined(__APPLE__)
+ auto dir = std::getenv("HOME");
+ if (dir) {
+ config_dir = std::filesystem::path(dir);
+ config_dir /= "Library/Application Support/ADBC";
+ }
+#elif defined(__linux__)
+ auto dir = std::getenv("XDG_CONFIG_HOME");
+ if (!dir) {
+ dir = std::getenv("HOME");
+ if (dir) {
+ config_dir = std::filesystem::path(dir) /= ".config";
+ }
+ } else {
+ config_dir = std::filesystem::path(dir);
+ }
+
+ if (!config_dir.empty()) {
+ config_dir /= "adbc";
+ }
+#endif
+
+ return config_dir;
+}
+
+#ifdef _WIN32
+using char_type = wchar_t;
+
+std::string utf8_encode(const std::wstring& wstr) {
Review Comment:
This isn't resolved? We should try to follow the existing convention
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]