INNER CODE UNIT · Rust

find_plugin_file

Drew-Alleman/DataSurgeon · src/plugins/mod.rs:114

pub fn find_plugin_file() -> Option<String> {
    let path: String = get_plugin_path();
    if Path::new(&path).exists() {
        return Some(path);
    } else if Path::new(LOCAL_PLUGIN_PATH).exists() {
        return Some(String::from(LOCAL_PLUGIN_PATH));
    }
    None
}


// Loads plugins from a JSON file.
//
// This function attempts to find and open a `plugins.json` file. If the file is found and opened successfully,
// it reads the file content into a string and attempts to parse that string into a vector of `RegexPlugin` objects.
//
// If the file cannot be found, opened, or parsed successfully, it prompts the user to decide whether to exit the program or continue.
// If the user chooses to continue, it returns an empty vector.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…