zeroshade commented on code in PR #3099: URL: https://github.com/apache/arrow-adbc/pull/3099#discussion_r2195209863
########## rust/core/src/driver_manager.rs: ########## @@ -184,6 +205,41 @@ impl ManagedDriver { Ok(ManagedDriver { inner }) } + /// Load a driver either by name, filename, path, or via locating a toml manifest file. + /// The LoadFlags control what directories are searched to locate a manifest. + pub fn load_from_name( + name: impl AsRef<OsStr>, + entrypoint: Option<&[u8]>, + version: AdbcVersion, + load_flags: LoadFlags, + ) -> Result<Self> { + let driver_path = Path::new(name.as_ref()); + let allow_relative = load_flags & LOAD_FLAG_ALLOW_RELATIVE_PATHS != 0; + if let Some(ext) = driver_path.extension() { + if !allow_relative && driver_path.is_relative() { + return Err(Error::with_message_and_status( + "Relative paths are not allowed", + Status::InvalidArguments, + )); + } + + if ext == "toml" { + Self::load_from_manifest(driver_path, entrypoint, version) + } else { + Self::load_dynamic_from_filename(driver_path, entrypoint, version) + } + } else if driver_path.is_absolute() { + let toml_path = driver_path.with_extension("toml"); + if toml_path.is_file() { + return Self::load_from_manifest(&toml_path, entrypoint, version); + } + + Self::load_dynamic_from_filename(driver_path, entrypoint, version) + } else { + Self::find_driver(driver_path, entrypoint, version, load_flags) + } Review Comment: I'll update the doc string. I don't think that adding new methods would significantly improve understanding the logic. But i'll take a look -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org