Skip to main content

locate_file

Function locate_file 

Source
pub fn locate_file(file_name: &str) -> Result<String>
Expand description

Searches for a file within the Java installation directory.

Supports wildcard patterns in the file name.

§Arguments

  • file_name - The name of the file to search for (supports wildcards)

§Returns

  • Ok(String) containing the directory path where the file is located
  • Err(JavaLocatorError) if the file cannot be found

§Examples

use java_manager;

fn main() -> java_manager::Result<()> {
    // Find libjsig.so
    let libjsig_dir = java_manager::locate_file("libjsig.so")?;
    println!("libjsig.so directory: {}", libjsig_dir);

    // Search with wildcard
    let jvm_lib_dir = java_manager::locate_file("libjvm*")?;
    println!("JVM library directory: {}", jvm_lib_dir);

    Ok(())
}